DATETIME( ) example
The following statements convert a DateTime value to a string using DTTOC (DateTime to Character) and extracts the date and time strings. The following examples assume SET HOURS is set to 12, thereby displaying the AM/PM indicator.
d=DATETIME() // Yields 08/17/00 04:25:45 PM
d1=DTTOC(d) //Yields 08/17/00 04:25:45 PM as a Character string
d2=left(d1,8) //Yields 08/17/00 as a Character string
d3=right(d1,11) //Yields 04:25:45 PM as a Character string
Fun with Numbers
Adding 1 to a DateTime value increases the value by 24 hours, or 1 day.
d1=DATETIME()
?d1 //Yields 01/19/01 08:10:41 AM
?d1+1 //Yields 01/20/01 08:10:41 AM
To increase the DateTime value by 1 second, add 1/86400 of a day (86400 being the number of seconds in a day).
?d1+1/86400 //Yields 01/19/01 08:10:42 AM
To increase the DateTime value by 1 minute, add 1/1440 of a day (86400/60 being the number of minutes in a day).
?d1+1/1440 //Yields 01/19/01 08:11:41 AM