Search…
Resources
Related Links
datetime
To convert to or return a 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)
β€Œ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)
β€Œ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)
β€Œ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.
Last modified 2mo ago
Export as PDF
Copy link