<Time>

[ Values | now | notime | Type Constructors | Get | difftime | Operators ]


Values

The values of type time are legal points in time. That is, a (gregorian calender) date and an hour-minute-second time of day. Illegal times, such as "1999/02/29, 20:61:30" are automatically converted to legal ones ("1999/03/01, 21:01:30"). All time values must be within the following range [1970/01/01, 00:00:00..2038/01/19, 03:14:07]. Any attempts to construct a time not in this interval will result in the special time value called notime which is also the default value for the type time. All time values are assumed to be in the server's local timezone.


now

exp ::= now ( )
This predefined function returns the current local time.


notime

This is a constant time value which is less than all other time values. It is the default value for variables of type time and it is produced whenever illegal time operations are performed. Attempts to get components from a notime value will produce a runtime error.


Type Constructors

exp ::= time ( exp , exp , exp )
This time contructor takes three integer arguments, a year (1970-2038), a month (1-12), and a day (1-31) and will construct the corresponding point in time (with time-of-day: 00:00:00).

exp ::= time ( exp , exp , exp , exp , exp , exp )
This time contructor takes six integer arguments, a year (1970-2038), a month (1-12), a day (1-31), an hour (0-23), a minute (0-59), and a second (0-59) and will construct the corresponding point in time.


Get

exp ::= getYear ( exp )
Returns an integer (1970-2038) with the year component of the given time value.

exp ::= getMonth ( exp )
Returns an integer (1-12) with the month component of the given time value.

exp ::= getDay ( exp )
Returns an integer (1-31) with the day component of the given time value.

exp ::= getHour ( exp )
Returns an integer (0-23) with the hour component of the given time value.

exp ::= getMinute ( exp )
Returns an integer (0-59) with the minute component of the given time value.

exp ::= getSecond ( exp )
Returns an integer (0-59) with the second component of the given time value.

exp ::= getWeekday ( exp )
Returns an integer (1-7) with the weekday component of the given time value (Monday is one and Sunday is seven).


difftime

exp ::= difftime ( exp , exp )

This predefined function takes two time values and produces an integer holding the difference between the two points in time in seconds.


Operators

The following binary operators are available on values of type time:

Operator Description
__<__ less than
__>__ greater than
__<=__ less than or equal
__>=__ greater than or equal
__==__ equal
__!=__ not equal
__=__ assignment


bigwig@brics.dk
Last updated: November 2, 2001
Valid HTML 4.01!