0

datetime

To convert to or return a local timestamp

You can use this function to create a timestamp from a date and time or numeric values. If the parameter for the time is missing, it will automatically use 00:00.

Syntax

datetime(number)

datetime(number, number, number)

datetime(number, number, number, number)

datetime(number, number, number, number, number)

datetime(number, number, number, number, number, number)

Return

timestamp

Examples

❗ Your result format may be different depending on your settings.

datetime(year, month, day) To return a timestamp out of the given year, month, and day numbers.

datetime(2021, 5, 27)datetime(2021, 5, 27)

Result: 05/27/2021 00:00 (the time is set automatically) (US)

datetime(year, month, day, hour) To return a timestamp out of the given year, month, day, and hour numbers.

datetime(year, month, day, hour, minute) To return a timestamp out of the given year, month, day, hour, and minute numbers.

datetime(2021, 05, 27, 18, 5)datetime(2021, 05, 27, 18, 5)

Result: 05/27/2021 18:05 (US) 27.05.2021 18:05

datetime(year, month, day, hour, minute, second) To return a timestamp out of the given year, month, day, hour, minute, and second numbers.

datetime(year, month, day, hour, minute, second, millis) To return a timestamp out of the given year, month, day, hour, minute, second, and millisecond numbers.

datetime(myDate, myTime) To convert a given date and a time to a timestamp.

datetime(Date, Time)datetime(Date, Time)

Result: The date of the field Date and the time of the field Time, for example, 05/27/2021 18:05.

datetime(millis) To convert a given number to a timestamp where the number represents the Unix time in milliseconds.

See also

date which converts to or returns a date value.

time which returns the current time.

format which formats a given value.

Reply

null