Data type: Time

The Time data type is a primitive data type represented by the number 3 in the database dictionary. In all of the examples in this topic, the following acronyms apply: MM=month; DD=day; DDD=day; YY=year; HH=hours; MM=minutes; SS=seconds. Furthermore, MM/DD/YY is collectively referred to as date and HH:MM:SS is collectively referred to as time. The following rules govern the use of the time data type:

  • Time must be enclosed in single quotation marks.
  • Time is recorded on a 24-hour clock. '00:00:00' is midnight, '12:00:00' is noon, '18:00:00' is 6 p.m.
  • Enter absolute time in the following format: 'MM/DD/YY HH:MM:SS'. The format's sequence is affected by the set.timezone() function. It determines the order of date (MM/DD/YY). Note that absolute time is stored as GMT notation.
  • Enter relative time in the following format: 'DDD HH:MM:SS'
  • The use of seconds is optional. If you do not use seconds, the default is :00.
  • The use of time is optional in absolute time. If you omit time, it defaults to 00:00:00. For example, 'MM/DD/YY' is 'MM/DD/YY 00:00:00'.
  • The use of days is optional in relative time. If you omit days, the default is 0. For example '12:00' is zero days and 12 hours, '345 03:00' is 345 days and 3 hours.
  • Use $time = '00:00' to set a time variable to a 0 (zero) value.

The following date/time formats show valid times/dates accepted by RAD:

Date/time format Description Valid literal examples
Absolute time Indicates a specific date and time '07/16/83 04:30:00'
Relative time Indicates an amount of time '197 05:00' (means 197 days and 5 hours)
Relative time Indicates an amount of time '1 00:00:00' (means 1 day)