Functions - time

addDuration

Add specified durations to the given time value.

createTime

Returns the Time object correspoding to the given time components and time-zone.

currentTime

Returns the current time value with the system default time-zone.

format

Returns formatted string representation of the given time.

getDate

Returns the date representation of the given time.

getDay

Returns the date representation of the given time.

getHour

Returns the hour representation of the given time.

getMilliSecond

Returns the millisecond representation of the given time.

getMinute

Returns the minute representation of the given time.

getMonth

Returns the month representation of the given time.

getSecond

Returns the second representation of the given time.

getTime

Returns the time representation of the given time.

getWeekday

Returns the weekday representation of the given time.

getYear

Returns the year representation of the given time.

nanoTime

Returns the current system time in nano seconds.

parse

Returns the time for the given string representation based on the given format string.

subtractDuration

Subtract specified durations from the given time value.

toString

Returns ISO 8601 string representation of the given time.

toTimeZone

Change the time-zone of the given time.

addDuration

(Time time, int years, int months, int days, int hours, int minutes, int seconds, int milliSeconds)

returns Time

Add specified durations to the given time value.

Parameters

  • time Time
  • The Time record to add the duration to

  • years int
  • The year representation

  • months int
  • The month-of-year to represent, from 1 (January) to 12 (December)

  • days int
  • The day-of-month to represent, from 1 to 31

  • hours int
  • The hour-of-day to represent, from 0 to 23

  • minutes int
  • The minute-of-hour to represent, from 0 to 59

  • seconds int
  • The second-of-minute to represent, from 0 to 59

  • milliSeconds int
  • The milli-of-second to represent, from 0 to 999

  • Return Type

    (Time)
  • Time object containing time and zone information after the addition

createTime

(int year, int month, int date, int hour, int minute, int second, int milliSecond, string zoneId)

returns Time | Error

Returns the Time object correspoding to the given time components and time-zone.

Parameters

  • year int
  • The year representation

  • month int
  • The month-of-year to represent, from 1 (January) to 12 (December)

  • date int
  • The day-of-month to represent, from 1 to 31

  • hour int
  • The hour-of-day to represent, from 0 to 23

  • minute int
  • The minute-of-hour to represent, from 0 to 59

  • second int
  • The second-of-minute to represent, from 0 to 59

  • milliSecond int
  • The milli-of-second to represent, from 0 to 999

  • zoneId string
  • The zone id of the required time-zone.If empty the system local time-zone will be used

  • Return Type

    (Time | Error)
  • Time object containing time and zone information or an time:Error if failed to create the time

currentTime

()

returns Time

Returns the current time value with the system default time-zone.

  • Return Type

    (Time)
  • Time object containing the time and zone information

format

(Time time, string | TimeFormat timeFormat)

returns string | Error

Returns formatted string representation of the given time.

Parameters

  • time Time
  • The Time record to be formatted

  • timeFormat string | TimeFormat
  • The format which is used to format the time represented by this object

  • Return Type

    (string | Error)
  • The formatted string of the given time or an time:Error if failed to format the time

getDate

(Time time)

returns [int, int, int]

Returns the date representation of the given time.

Parameters

  • time Time
  • The Time record to get the date representation from

  • Return Type

    ([int, int, int])
  • The year representation. The month-of-year, from 1 (January) to 12 (December). The day-of-month, from 1 to 31.

getDay

(Time time)

returns int

Returns the date representation of the given time.

Parameters

  • time Time
  • The Time record to get the date representation from

  • Return Type

    (int)
  • The day-of-month, from 1 to 31

getHour

(Time time)

returns int

Returns the hour representation of the given time.

Parameters

  • time Time
  • The Time record to get the hour representation from

  • Return Type

    (int)
  • The hour-of-day, from 0 to 23

getMilliSecond

(Time time)

returns int

Returns the millisecond representation of the given time.

Parameters

  • time Time
  • The Time record to get the millisecond representation from

  • Return Type

    (int)
  • The milli-of-second, from 0 to 999

getMinute

(Time time)

returns int

Returns the minute representation of the given time.

Parameters

  • time Time
  • The Time record to get the minute representation from

  • Return Type

    (int)
  • The minute-of-hour to represent, from 0 to 59

getMonth

(Time time)

returns int

Returns the month representation of the given time.

Parameters

  • time Time
  • The Time record to get the month representation from

  • Return Type

    (int)
  • The month-of-year, from 1 (January) to 12 (December)

getSecond

(Time time)

returns int

Returns the second representation of the given time.

Parameters

  • time Time
  • The Time record to get the second representation from

  • Return Type

    (int)
  • The second-of-minute, from 0 to 59

getTime

(Time time)

returns [int, int, int, int]

Returns the time representation of the given time.

Parameters

  • time Time
  • The Time record

  • Return Type

    ([int, int, int, int])
  • The hour-of-day, from 0 to 23. The minute-of-hour to represent, from 0 to 59. The second-of-minute, from 0 to 59. The milli-of-second, from 0 to 999.

getWeekday

(Time time)

returns string

Returns the weekday representation of the given time.

Parameters

  • time Time
  • The Time record to get the weekday representation from

  • Return Type

    (string)
  • The weekday representation from SUNDAY to SATURDAY

getYear

(Time time)

returns int

Returns the year representation of the given time.

Parameters

  • time Time
  • The Time record to retrieve the year representation from

  • Return Type

    (int)
  • The year representation

nanoTime

()

returns int

Returns the current system time in nano seconds.

  • Return Type

    (int)
  • Int value of the current system time in nano seconds

parse

(string data, string | TimeFormat timeFormat)

returns Time | Error

Returns the time for the given string representation based on the given format string.

Parameters

  • data string
  • The time text to parse

  • timeFormat string | TimeFormat
  • The format which is used to parse the given text

  • Return Type

    (Time | Error)
  • Time object containing time and zone information or an time:Error if failed to parse the given string

subtractDuration

(Time time, int years, int months, int days, int hours, int minutes, int seconds, int milliSeconds)

returns Time

Subtract specified durations from the given time value.

Parameters

  • time Time
  • The Time record to subtract the duration from

  • years int
  • The year representation

  • months int
  • The month-of-year to represent, from 1 (January) to 12 (December)

  • days int
  • The day-of-month to represent, from 1 to 31

  • hours int
  • The hour-of-day to represent, from 0 to 23

  • minutes int
  • The minute-of-hour to represent, from 0 to 59

  • seconds int
  • The second-of-minute to represent, from 0 to 59

  • milliSeconds int
  • The milli-of-second to represent, from 0 to 999

  • Return Type

    (Time)
  • Time object containing time and zone information after the subtraction

toString

(Time time)

returns string

Returns ISO 8601 string representation of the given time.

Parameters

  • time Time
  • The Time record to be converted to string

  • Return Type

    (string)
  • The ISO 8601 formatted string of the given time

toTimeZone

(Time time, string zoneId)

returns Time | Error

Change the time-zone of the given time.

Parameters

  • time Time
  • The Time record of which the time-zone to be changed

  • zoneId string
  • The new time-zone id

  • Return Type

    (Time | Error)
  • Time object containing time and zone information after the conversion or an time:Error if failed to format the time