datetime() Function

Converts the given Date and Time into a serial number that holds the Date and Time data type.


datetime( year, month, day, [hour], [minute], [second] )

year: (Integer) The year of the you would like to convert into a serial number.

month: (Integer) Only numbers are accepted, not month names. Do not include leading zeroes for a month with one digit.

day: (Integer) The day of the Date and Time.

hour: (Integer) The hour of the Date and Time.

minute: (Integer) The minute of the Date and Time.

second: (Integer) The seconds of the Date and Time.


Date and Time


The value is converted to GMT when stored.


You can experiment with this function in the test box below.

Test Input

datetime(2011,2,28,12,0,0) returns 2/28/2011 7:00 AM EST

Appending a Time to a Date:

datetime(year(pv!yourDate), month(pv!yourdate), day(pv!yourDate), 23, 59, 00) returns 6/8/1984 7:59 PM EDT by adding the time 11:59 pm to a given date where pv!yourDate is 6/8/1984 and applying the timezone conversion.

See Also

userdatetime(): Use this function to return a Datetime value in the local time zone.

Open in Github Built: Fri, Mar 11, 2022 (04:59:07 PM)

On This Page