Time-date constants

A time-date constant consists of a time and/or a date enclosed in brackets formatted as follows:

  • 12-hour time -- A time in the format [hh:mm:ss] followed by the letters AM or PM. The hours can range from 00 to 12. The seconds are optional and default to 00.
  • 24-hour time -- A time in the format [hh:mm:ss]. The hours can range from 00 to 23. The seconds are optional and default to 00.
  • Date -- A date in the operating system's default date format. Some examples include:

    Region

    Default date format

    Entering "[01/02/03]" results in

    United States

    '[mm/dd/yyyy]

    January 2, 2003

    France

    '[dd/mm/yyyy]

    February 1, 2003

    Japan

    '[yyyy/mm/dd]

    February 3, 2001

    The year (yyyy) is optional and defaults to the current year. If you use yy to specify a year, in the 20th century, yy is 50 or greater and in the 21st century, yy is less than 50. The validity of a date format depends on the date separator that users choose in their operating system control panel. The default separator for Windows, UNIX, and Macintosh is a slash (/).

  • Time and date -- A time and a date in the format [time date] or [date time].

If time-date values are subtracted, the result is an integer that represents the difference between the times in seconds.

The following table shows the formats you can use to specify a date in a Notes® field, assuming the operating system's default date format is US English and the year is 2002.

Tip: Display Time must be selected in the Date/Time field properties box for the time to display. It is not selected by default.

Time-date format

Constant

Date/Time field result

Text field result

24-hour time

[5:30]

05:30 AM

05:30:00 AM

12-hour time

[5:30 PM]

05:30 PM

05:30:00 PM

24-hour time

[17:30]

05:30 PM

05:30:00 PM

Date

[6/15]

06/15/2002

06/15/2002

Date

[6/15/02]

06/15/2002

06/15/2002

Time-date

[6/15 5:30 PM]

06/15/2002 05:30 PM

06/15/2002 05:30:00 PM

Time-date

[5:30 PM 6/15]

06/15/2002 05:30 PM

06/15/2002 05:30:00 PM

Difference

[5:30 PM]-[5:30]

43200.00

43200

Specifying time zones

To specify a time zone in a Time zone field, you can select a zone from a drop-down list of options or use the functions @TimeZoneToText and @TextToTimeInZone to manipulate the formats in which time values display programmatically.

Notes® converts and saves human-readable time zone values using the following time zone attributes:

Attribute

Definition

Z

Time zone offset from GMT.

DO

Daylight Saving Time (DST) observed flag. 1 means DST is in effect; 0 means it is not. If equal to 1, a value should be supplied for DL.

DL

DST law identifying the <StartMonth> <StartWeek> <StartDayOfWeek> <EndMonth> <EndWeek> <EndDayOfWeek>.

ZX

(Optional) Host-specific time zone index.

ZN

(Optional) Time zone name.

For example, if you select "(GMT -05:00) Eastern Time (US & Canada)" from the Time zone drop-down list, Notes® saves the value as:

Z=5$DO=1$DL=4 1 1 10 -1 1$ZX=25$ZN=Eastern

This indicates that the time zone is 5 hours before Greenwich Mean Time (-5). DST is in effect and starts in the month of April(4), during week 1, on day 1 of the week, which is a Sunday, and ends in October(10), during the last week (-1), also on a Sunday(1). The ZX and ZN attributes are values used exclusively by Notes®.

If you use a Time zone field as the default value for a view column, it displays as a similar string of attribute and value pairs. Use @TimeZoneToText to convert the field to a human-readable format.

You can enter these attribute and value pairs as the default value for a Time zone field, or you can let the @TimeToTextInZone function do the work for you. For example, to display a box specifying the current time in Alaska, you could create a Hotspot button with this formula:

@Prompt([Ok];"Current time in Alaska";@TimeToTextInZone(@Now;"Z=9$DO=1$DL=4 1 1 10 -1 1"))

or you could create a Time zone field called zone from which the user could select the zone for which they would like to see the current time, then display that time in a message box by adding this formula to the Hotspot button:

@Prompt([Ok];"Current time there";@TimeToTextInZone(@Now;zone))