Skip to content
M. Klatte edited this page Apr 22, 2015 · 5 revisions

This library offers some time-related functions.

Requirements
These functions require the TextLib with exact this name.

File
Time.Script.txt

Functions

Void Time_SetTimezone(Text _TimezoneName)
Sets the current timezone to _TimezoneName and uses this zone for all further function calls. You can use any name from the list below.

Integer Time_GetTimezoneOffset([Text _TimezoneName])
Returns the Offset for the given timezone as (hours * 100 + minutes). You can calculate the hours as hours = offset / 100 and minutes as minutes = offset % 1000 % 100.

Text Time_GetTimezoneName([Text _TimezoneName])
Returns a string like Coordinated Universal Time according to the current timezone.

Text Time_GetTimezoneLocation([Text _TimezoneName])
Returns a string like Europe, Africa according to the current timezone.

Text Time_GetTimezoneAbbreviation([Text _TimezoneName])
Returns a string like GMT according to the current timezone.

Boolean Time_IsLeapYear(Integer _Year)
Returns whether the given year is a leap year.

Integer Time_DayOfWeek(Integer _Year, Integer _Month, Integer _Day)
Returns the Day within the week from 0 (Sunday) to 6 (Saturday).

Integer Time_WeekOfYear(Integer _Year, Integer _Month, Integer _Day)
Returns the Week within the year.

Integer Time_Timestamp(Integer _Year, Integer _Month, Integer _Day, Integer _Hour, Integer _Minute, Integer _Second[, Integer _UTCOffset])
Returns the Unix Timestamp in seconds for the given date.

Integer[Text] Time_FromText(Text date)
Parses the CurrentLocalDateText format into the fields year, month, day, hour, minute, second.

Integer Time_Timestamp([Integer _UTCOffset])
Returns the Unix Timestamp in seconds from the CurrentLocalDateText field, thus you might want to consider giving an offset to the UTC time.

Integer[Text] Time_FromTimestamp(Integer _Timestamp)
Translates the given _Timestamp into the fields year, month, day, hour, minute, second.

Text Time_Date([Integer[Text] _Parts, Text _Format])
Formats a date according to _Format. Is no _Parts array given, it uses the current Time, is no _Format given, it uses the CurrentLocalDateText format.

Text Time_Date(Integer _Timestamp[, Text _Format])
Text Time_Date(Integer _Year, Integer _Month, Integer _Day, Integer _Hour, Integer _Minute, Integer _Second, Integer _UTCOffset[, Text _Format])
Text Time_Date(Integer _Year, Integer _Month, Integer _Day, Integer _Hour, Integer _Minute, Integer _Second[, Text _Format])
Formats the given time with the given Format.

TimeFormats

Time comes with predefined date formats:

  • TIME_DATE_ATOM
    "Y-d-m\TH:i:sP" (example: 2005-08-15T15:52:01+00:00)
  • TIME_DATE_COOKIE
    "l, d-M-Y H:i:s T" (example: Monday, 15-Aug-2005 15:52:01 UTC)
  • TIME_DATE_ISO8601
    "Y-d-m\TH:i:sO" (example: 2005-08-15T15:52:01+0000)
  • TIME_DATE_RFC822
    "D, d M y H:i:s O" (example: Mon, 15 Aug 05 15:52:01 +0000)
  • TIME_DATE_RFC850
    "l, d-M-y H:i:s T" (example: Monday, 15-Aug-05 15:52:01 UTC)
  • TIME_DATE_RFC1036
    "D, d M y H:i:s O" (example: Mon, 15 Aug 05 15:52:01 +0000)
  • TIME_DATE_RFC1123
    "D, d M Y H:i:s O" (example: Mon, 15 Aug 2005 15:52:01 +0000)
  • TIME_DATE_RFC2822
    "D, d M Y H:i:s O" (example: Mon, 15 Aug 2005 15:52:01 +0000)
  • TIME_DATE_RFC3339
    "Y-d-m\TH:i:sP" (example: 2005-08-15T15:52:01+00:00)
  • TIME_DATE_RSS
    "D, d M Y H:i:s O" (example: Mon, 15 Aug 2005 15:52:01 +0000)
  • TIME_DATE_W3C
    "Y-m-d\TH:i:sP" (example: 2005-08-15T15:52:01+00:00)
  • TIME_DATE_MANIAPLANET
    "Y/m/d H:i:s" (example: 2014/11/14 10:35:20)

See http://php.net/manual/en/function.date.php for explanation of the identifiers.

Timezones

  • ACDT (UTC +1030)
  • ACST (UTC +930)
  • ACT (UTC -500)
  • ACWST (UTC +845)
  • ADT (UTC +300)
  • ADT (UTC -300)
  • AEDT (UTC +1100)
  • AEST (UTC +1000)
  • AFT (UTC +430)
  • AKDT (UTC -800)
  • AKST (UTC -900)
  • ALMT (UTC +600)
  • AMST (UTC -300)
  • AMST (UTC +500)
  • AMT (UTC -400)
  • AMT (UTC +400)
  • ANAST (UTC +1200)
  • ANAT (UTC +1200)
  • AQTT (UTC +500)
  • ART (UTC -300)
  • AST (UTC +300)
  • AST (UTC -400)
  • AWDT (UTC +900)
  • AWST (UTC +800)
  • AZOST (UTC +000)
  • AZOT (UTC -100)
  • AZST (UTC +500)
  • AZT (UTC +400)
  • BNT (UTC +800)
  • BOT (UTC -400)
  • BRST (UTC -200)
  • BRT (UTC -300)
  • BST (UTC +600)
  • BST (UTC +100)
  • BTT (UTC +600)
  • CAST (UTC +800)
  • CAT (UTC +200)
  • CCT (UTC +630)
  • CDT (UTC -500)
  • CDT (UTC -400)
  • CEST (UTC +200)
  • CET (UTC +100)
  • CHADT (UTC +1345)
  • CHAST (UTC +1245)
  • CHOT (UTC +800)
  • CHUT (UTC +1000)
  • CKT (UTC -1000)
  • CLST (UTC -300)
  • CLT (UTC -400)
  • COT (UTC -500)
  • CST (UTC -600)
  • CST (UTC +800)
  • CST (UTC -500)
  • CVT (UTC -100)
  • CXT (UTC +700)
  • CHST (UTC +1000)
  • DAVT (UTC +700)
  • EASST (UTC -500)
  • EAST (UTC -600)
  • EAT (UTC +300)
  • ECT (UTC -500)
  • EDT (UTC -400)
  • EEST (UTC +300)
  • EET (UTC +200)
  • EGST (UTC +000)
  • EGT (UTC -100)
  • EST (UTC -500)
  • FET (UTC +300)
  • FJST (UTC +1300)
  • FJT (UTC +1200)
  • FKST (UTC -300)
  • FKT (UTC -400)
  • FNT (UTC -200)
  • GALT (UTC -600)
  • GAMT (UTC -900)
  • GET (UTC +400)
  • GFT (UTC -300)
  • GILT (UTC +1200)
  • GMT (UTC +000)
  • GST (UTC +400)
  • GYT (UTC -400)
  • HADT (UTC -900)
  • HAST (UTC -1000)
  • HKT (UTC +800)
  • HOVT (UTC +700)
  • ICT (UTC +700)
  • IDT (UTC +300)
  • IOT (UTC +600)
  • IRDT (UTC +430)
  • IRKST (UTC +900)
  • IRKT (UTC +800)
  • IRST (UTC +330)
  • IST (UTC +530)
  • IST (UTC +100)
  • IST (UTC +200)
  • JST (UTC +900)
  • KGT (UTC +600)
  • KOST (UTC +1100)
  • KRAST (UTC +800)
  • KRAT (UTC +700)
  • KST (UTC +900)
  • KUYT (UTC +400)
  • LHDT (UTC +1100)
  • LHST (UTC +1030)
  • LINT (UTC +1400)
  • MAGST (UTC +1200)
  • MAGT (UTC +1000)
  • MART (UTC -930)
  • MAWT (UTC +500)
  • MDT (UTC -600)
  • MHT (UTC +1200)
  • MMT (UTC +630)
  • MSD (UTC +400)
  • MSK (UTC +300)
  • MST (UTC -700)
  • MUT (UTC +400)
  • MVT (UTC +500)
  • MYT (UTC +800)
  • NCT (UTC +1100)
  • NDT (UTC -230)
  • NFT (UTC +1130)
  • NOVST (UTC +700)
  • NOVT (UTC +600)
  • NPT (UTC +545)
  • NRT (UTC +1200)
  • NST (UTC -330)
  • NUT (UTC -1100)
  • NZDT (UTC +1300)
  • NZST (UTC +1200)
  • OMSST (UTC +700)
  • OMST (UTC +600)
  • ORAT (UTC +500)
  • PDT (UTC -700)
  • PET (UTC -500)
  • PETST (UTC +1200)
  • PETT (UTC +1200)
  • PGT (UTC +1000)
  • PHOT (UTC +1300)
  • PHT (UTC +800)
  • PKT (UTC +500)
  • PMDT (UTC -200)
  • PMST (UTC -300)
  • PONT (UTC +1100)
  • PST (UTC -800)
  • PST (UTC -800)
  • PWT (UTC +900)
  • PYST (UTC -300)
  • PYT (UTC -400)
  • QYZT (UTC +600)
  • RET (UTC +400)
  • SAKT (UTC +1000)
  • SAMT (UTC +400)
  • SAST (UTC +200)
  • SBT (UTC +1100)
  • SCT (UTC +400)
  • SGT (UTC +800)
  • SRET (UTC +1100)
  • SRT (UTC -300)
  • SST (UTC -1100)
  • TAHT (UTC -1000)
  • TFT (UTC +500)
  • TJT (UTC +500)
  • TKT (UTC +1300)
  • TLT (UTC +900)
  • TMT (UTC +500)
  • TOT (UTC +1300)
  • TVT (UTC +1200)
  • ULAT (UTC +800)
  • UTC (UTC "UTC)
  • UYST (UTC -200)
  • UYT (UTC -300)
  • UZT (UTC +500)
  • VET (UTC -430)
  • VLAST (UTC +1100)
  • VLAT (UTC +1000)
  • VUT (UTC +1100)
  • WARST (UTC -300)
  • WAST (UTC +200)
  • WAT (UTC +100)
  • WEST (UTC +100)
  • WET (UTC +000)
  • WFT (UTC +1200)
  • WGST (UTC -200)
  • WGT (UTC -300)
  • WIB (UTC +700)
  • WIT (UTC +900)
  • WITA (UTC +800)
  • WST (UTC +1300)
  • WST (UTC +100)
  • WT (UTC +000)
  • YAKST (UTC +1000)
  • YAKT (UTC +900)
  • YAPT (UTC +1000)
  • YEKST (UTC +600)
  • YEKT (UTC +500)
You can’t perform that action at this time.