Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Time Source Code
 previous   up   next 

Types
time
Describes times and dates.

time

const type: time

Describes times and dates. For dates the proleptic Gregorian calendar is used (which assumes that the Gregorian calendar was even in effect at dates preceding its official introduction). This convention is used according to ISO 8601 which also defines that positive and negative years exist and that the year preceding 1 is 0. Time is measured in hours, minutes, seconds and micro seconds. Additionally information about the difference to UTC and a flag indicating daylight saving time is maintained also.


Operator Summary
time
(attr time) parse (in var string: stri)
Convert a string in the ISO 8601 date format to a time.
boolean
(in time: aTime1) = (in time: aTime2)
Check if two time values are equal.
boolean
(in time: aTime1) <> (in time: aTime2)
Check if two time values are not equal.
boolean
(in time: aTime1) <= (in time: aTime2)
Check if aTime1 is less than or equal to aTime2.
boolean
(in time: aTime1) >= (in time: aTime2)
Check if aTime1 is greater than or equal to aTime2.
boolean
(in time: aTime1) < (in time: aTime2)
Check if aTime1 is less than aTime2.
boolean
(in time: aTime1) > (in time: aTime2)
Check if aTime1 is greater than aTime2.

Function Summary
boolean
isLeapYear (in integer: year)
Determine if a year is a leap year in the Gregorian calendar.
integer
daysInYear (in integer: year)
Determine the number of days in a 'year'.
integer
daysInMonth (in integer: year, in integer: month)
Determine the number of days in the 'month' of the given 'year'.
integer
daysInMonth (in time: date)
Determine the number of days in the month of a given date.
string
strDate (in time: aTime)
Convert a time to a string with ISO 8601 YYYY-MM-DD date format.
string
strTime (in time: aTime)
Convert a time to a string with ISO 8601 hh:mm:ss time format.
string
strDateTime (in time: aTime)
Convert a time to a string with ISO 8601 date and time format.
string
str (in time: aTime)
Convert a time to a string with ISO 8601 date and time format.
integer
compare (in time: aTime1, in time: aTime2)
Compares two times.
integer
hashCode (in time: aTime)
Compute the hash value of a time.
time
truncToSecond (in time: aTime)
Truncate 'aTime' to the beginning of a second.
time
truncToMinute (in time: aTime)
Truncate 'aTime' to the beginning of a minute.
time
truncToHour (in time: aTime)
Truncate 'aTime' to the beginning of a hour.
time
truncToDay (in time: aTime)
Truncate 'aTime' to the beginning of a day.
time
truncToMonth (in time: aTime)
Truncate 'aTime' to the beginning of the first day in the month.
time
truncToYear (in time: aTime)
Truncate 'aTime' to the beginning of the first day in the year.
integer
dayOfWeek (in time: aDate)
Return the weekday number of 'aDate'.
integer
dayOfYear (in time: aDate)
Return the day number in the year of 'aDate'.
integer
weekOfYear (in var integer: year, in integer: dayOfYear)
Return the week number of the 'year' for the 'dayOfYear'.
integer
weekOfYear (in time: aDate)
Return the week number of the year for 'aDate'.
integer
weekDateYear (in time: aDate)
Return the year of the ISO 8601 week date for 'aDate'.
integer
weekDateWeek (in time: aDate)
Return the week number of the ISO 8601 week date for 'aDate'.
time
toUTC (in time: aTime)
Convert a time to Coordinated Universal Time (UTC).
time
setLocalTZ (in time: aTime)
Sets timeZone and daylightSavingTime for a given time.
integer
julianDayNumber (in time: aDate)
Compute the julian day number of 'aDate'.
time
julianDayNumToTime (in integer: julianDayNumber)
Return the time of a 'julianDayNumber'.
integer
timestamp1970 (in time: aTime)
Return a time expressed in seconds since the Unix Epoch.
time
timestamp1970ToTime (in integer: timestamp)
Convert a timestamp into a time from the local time zone.
time
time (NOW)
Determine the current local time.
time
time (in integer: year, in integer: month, in integer: day, in integer: hour, in integer: minute, in integer: second)
Return the specified UTC time.
time
timeInTimeZone (in integer: year, in integer: month, in integer: day, in integer: hour, in integer: minute, in integer: second, in integer: timeZone)
Return the specified time in the specified timeZone.
time
date (in integer: year, in integer: month, in integer: day)
Return the specified UTC date.
void
await (ref time: aTime)
Wait until 'aTime' is reached

Operator Detail

parse

const func time: (attr time) parse (in var string: stri)

Convert a string in the ISO 8601 date format to a time. The accepted ISO 8601 date formats are YYYY-MM, YYYY-MM-DD, YYYY-MM-DDTHH, YYYY-MM-DDTHH:MM, YYYY-MM-DDTHH:MM:SS Additionally a space is also allowed to seperate the date and the time representations: YYYY-MM-DD HH, YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM:SS

Returns:
the time result of the conversion.
Raises:
RANGE_ERROR - When stri contains not a valid time value.

=

const func boolean: (in time: aTime1) = (in time: aTime2)

Check if two time values are equal.

Returns:
TRUE if both times are equal, FALSE otherwise.

<>

const func boolean: (in time: aTime1) <> (in time: aTime2)

Check if two time values are not equal.

Returns:
FALSE if both times are equal, TRUE otherwise.

<=

const func boolean: (in time: aTime1) <= (in time: aTime2)

Check if aTime1 is less than or equal to aTime2.

Returns:
TRUE if aTime1 is less than or equal to aTime2, FALSE otherwise.

>=

const func boolean: (in time: aTime1) >= (in time: aTime2)

Check if aTime1 is greater than or equal to aTime2.

Returns:
TRUE if aTime1 is greater than or equal to aTime2, FALSE otherwise.

<

const func boolean: (in time: aTime1) < (in time: aTime2)

Check if aTime1 is less than aTime2.

Returns:
TRUE if aTime1 is less than aTime2, FALSE otherwise.

>

const func boolean: (in time: aTime1) > (in time: aTime2)

Check if aTime1 is greater than aTime2.

Returns:
TRUE if aTime1 is greater than aTime2, FALSE otherwise.

Function Detail

isLeapYear

const func boolean: isLeapYear (in integer: year)

Determine if a year is a leap year in the Gregorian calendar.

Returns:
TRUE if the year is a leap year, FALSE otherwise.

daysInYear

const func integer: daysInYear (in integer: year)

Determine the number of days in a 'year'.

Returns:
the number of days in the year.

daysInMonth

const func integer: daysInMonth (in integer: year, in integer: month)

Determine the number of days in the 'month' of the given 'year'.

Returns:
the number of days in the month.

daysInMonth

const func integer: daysInMonth (in time: date)

Determine the number of days in the month of a given date.

Returns:
the number of days in the month.

strDate

const func string: strDate (in time: aTime)

Convert a time to a string with ISO 8601 YYYY-MM-DD date format.

Returns:
the string result of the conversion.

strTime

const func string: strTime (in time: aTime)

Convert a time to a string with ISO 8601 hh:mm:ss time format.

Returns:
the string result of the conversion.

strDateTime

const func string: strDateTime (in time: aTime)

Convert a time to a string with ISO 8601 date and time format. The time is converted to the YYYY-MM-DD hh:mm:ss format. Microseconds, time zone and information about the daylight saving time are omitted.

Returns:
the string result of the conversion.

str

const func string: str (in time: aTime)

Convert a time to a string with ISO 8601 date and time format. The string has the format YYYY-MM-DD hh:mm:ss.uuuuuu followed by a time zone in the format UTC+n and (DST) when it is a daylight saving time. The microseconds (uuuuuu) are omitted when they are zero. A time zone of UTC+0 is also omitted.

Returns:
the string result of the conversion.

compare

const func integer: compare (in time: aTime1, in time: aTime2)

Compares two times.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in time: aTime)

Compute the hash value of a time.

Returns:
the hash value.

truncToSecond

const func time: truncToSecond (in time: aTime)

Truncate 'aTime' to the beginning of a second.

Returns:
the truncated time.

truncToMinute

const func time: truncToMinute (in time: aTime)

Truncate 'aTime' to the beginning of a minute.

Returns:
the truncated time.

truncToHour

const func time: truncToHour (in time: aTime)

Truncate 'aTime' to the beginning of a hour.

Returns:
the truncated time.

truncToDay

const func time: truncToDay (in time: aTime)

Truncate 'aTime' to the beginning of a day.

Returns:
the truncated time.

truncToMonth

const func time: truncToMonth (in time: aTime)

Truncate 'aTime' to the beginning of the first day in the month.

Returns:
the truncated time.

truncToYear

const func time: truncToYear (in time: aTime)

Truncate 'aTime' to the beginning of the first day in the year.

Returns:
the truncated time.

dayOfWeek

const func integer: dayOfWeek (in time: aDate)

Return the weekday number of 'aDate'.

Returns:
1 for monday, 2 for tuesday, and so on up to 7 for sunday.

dayOfYear

const func integer: dayOfYear (in time: aDate)

Return the day number in the year of 'aDate'.

Returns:
1 for the 1. of january and successive values up to 366.

weekOfYear

const func integer: weekOfYear (in var integer: year, in integer: dayOfYear)

Return the week number of the 'year' for the 'dayOfYear'. According to ISO 8601: Week number 1 of every year contains the 4. of january. Since 1st to 3rd of january might be in the previous week there can be also a week number 0.

Returns:
a week number from 0 to 53 for weeks belonging to the year of the given date.

weekOfYear

const func integer: weekOfYear (in time: aDate)

Return the week number of the year for 'aDate'. According to ISO 8601: Week number 1 of every year contains the 4. of january. Since 1st to 3rd of january might be in the previous week there can be also a week number 0.

Returns:
a week number from 0 to 53 for weeks belonging to the year of the given date.

weekDateYear

const func integer: weekDateYear (in time: aDate)

Return the year of the ISO 8601 week date for 'aDate'. At the beginning and the end of an Gregorian calendar year there might be days which belong to a week of the previous or next year. For example 2005-01-01 is 2004-W53-6 and 2007-12-31 is 2008-W01-1.

Returns:
the year in the range 'pred(aDate.year)' to 'succ(aDate.year)'.

weekDateWeek

const func integer: weekDateWeek (in time: aDate)

Return the week number of the ISO 8601 week date for 'aDate'. At the beginning and the end of an Gregorian calendar year there might be days which belong to a week of the previous or next year. For example 2005-01-01 is 2004-W53-6 and 2007-12-31 is 2008-W01-1.

Returns:
the week number in the range 1 to 53.

toUTC

const func time: toUTC (in time: aTime)

Convert a time to Coordinated Universal Time (UTC).

Returns:
the time in UTC.

setLocalTZ

const func time: setLocalTZ (in time: aTime)

Sets timeZone and daylightSavingTime for a given time.

Returns:
the time in the local time zone.

julianDayNumber

const func integer: julianDayNumber (in time: aDate)

Compute the julian day number of 'aDate'. The julian day number is the number of days that have elapsed since January 1, 4713 BC in the proleptic Julian calendar.

Returns:
the julian day number.

julianDayNumToTime

const func time: julianDayNumToTime (in integer: julianDayNumber)

Return the time of a 'julianDayNumber'. The julian day number is the number of days that have elapsed since January 1, 4713 BC in the proleptic Julian calendar.

Returns:
the time 0:00:00 at the day with the 'julianDayNumber'.

timestamp1970

const func integer: timestamp1970 (in time: aTime)

Return a time expressed in seconds since the Unix Epoch. The Unix Epoch (1970-01-01 00:00:00 UTC) corresponds to 0.

Returns:
the seconds since the Unix Epoch.

timestamp1970ToTime

const func time: timestamp1970ToTime (in integer: timestamp)

Convert a timestamp into a time from the local time zone. The timestamp is expressed in seconds since the Unix Epoch. The Unix Epoch (1970-01-01 00:00:00 UTC) corresponds to 0.

Returns:
the local time that corresponds to the timestamp.

time

const func time: time (NOW)

Determine the current local time.

Returns:
the current local time.

time

const func time: time (in integer: year, in integer: month, in integer: day, in integer: hour, in integer: minute, in integer: second)

Return the specified UTC time.


timeInTimeZone

const func time: timeInTimeZone (in integer: year, in integer: month, in integer: day, in integer: hour, in integer: minute, in integer: second, in integer: timeZone)

Return the specified time in the specified timeZone.


date

const func time: date (in integer: year, in integer: month, in integer: day)

Return the specified UTC date.


await

const proc: await (ref time: aTime)

Wait until 'aTime' is reached



 previous   up   next