Construct time
Syntax
dateTime($year, $month, $day, $hour, $minute, $second, $millisecond)
Description
Constructs a date value that represents a point in time (in the user calendar). Compatible with tl.core:DateTime
values.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
year | Number | Year of the date | yes | -/- |
month | Number | Month of the date. Counting starts from 0 (January = 0, February = 1 etc.) | yes | -/- |
day | Number | Day of the date. Counting starts at 1 (1 = first day of the month). | yes | -/- |
hour | Number | Hour of the date | no | 0 |
minute | Number | Minute of the date | no | 0 |
second | Number | Second of the date | no | 0 |
millisecond | Number | Millisecond of the date | no | 0 |
Return value
Type: Business Object
A date value for the specified day of the year including the time in the user calendar.
Examples
Note: The output may differ depending on the calendar's time zone.
Unformatted date
dateTime(2021, 11, 31, 23, 59, 59, 999)
Output: 31.12.2021
Formatted date
dateFormat("dd-MM-yy HH:mm:ss").format(dateTime(2021, 11, 31, 23, 59, 59, 999))
Output: 31-12-21 23:59:59
Incomplete date
dateFormat("dd-MM-yy HH:mm:ss").format(dateTime(2021, 11, 31))
Output: 31-12-21 00:00:00