$k. Time

new Time(hoursopt, minutesopt, secondsopt)

Constructs a Time from the argument(s), which can be a Date object, undefined, milliseconds (UTC) or component values. If undefined, the current time is returned

Parameters:
NameTypeAttributesDescription
hours<optional>

Date or hours

minutes<optional>

Minutes

seconds<optional>

Seconds

Represents a time without timezone

Methods

(static) parse(string, languageopt)

Parse the date/time string. Both ISO 8601 and localized strings are supported.

Parameters:
NameTypeAttributesDescription
stringstring

The string representation

languagestring<optional>

Either an ISO 639-1 or ISO 639-2B language code (e.g. "en" or "eng"), or a locale name without encoding (e.g. "en_US"). Locale names and language codes are not interchangeable, e.g. the values for "de" and "de_DE" are separated. If not defined, the locale/language of the process will be used. Ignored if the attribute is not translated.

Throws:
Returns:

The parsed date/time

equals(value) → {boolean}

Returns true if the values are equal

Parameters:
NameTypeDescription
value

Another attribute value

Returns:
Type: 
boolean

getHours() → {number}

Returns the hours

Returns:
Type: 
number

getMinutes() → {number}

Returns the minutes

Returns:
Type: 
number

getSeconds() → {number}

Returns the seconds

Returns:
Type: 
number

maxDate() → {Date}

Returns the latest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T23:59:59.999 for the date 2007-03-01. Assumes that this is a date/time of the local timezone

Returns:
Type: 
Date

maxUTCDate() → {Date}

Returns the latest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T23:59:59.999 for the date 2007-03-01. Assumes that this is a date/time of the local timezone

Returns:
Type: 
Date

minDate() → {Date}

Returns the earliest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T0:00:00.0 for the date 2007-03-01. Assumes that this is a date/time of the local timezone

Returns:
Type: 
Date

minUTCDate() → {Date}

Returns the earliest exact Javascript date that is within the range of this date/time, e.g. 2007-03-01T0:00:00.0 for the date 2007-03-01. Assumes that this is an UTC date/time

Returns:
Type: 
Date

setHours(hours)

Sets the hours

Parameters:
NameTypeDescription
hoursnumber

setMinutes(minutes)

Sets the minutes.

Parameters:
NameTypeDescription
minutesnumber

setSeconds(seconds)

Sets the seconds.

Parameters:
NameTypeDescription
secondsnumber

toDate() → {Date}

Returns the date/time as a Javascript date object. Assumes that this is a date/time of the local timezone

Returns:
Type: 
Date

toISOString()

Returns an ISO 8601 representation of the date/time

Since
  • 4.1.0

toJSON()

Returns a string representing the date/time, similar to Date.prototype.toJSON ( key )

toString(languageopt) → {string}

Returns the string representation. Equivalent to valueString()

Parameters:
NameTypeAttributesDescription
languagestring<optional>

Either an ISO 639-1 or ISO 639-2B language code (e.g. "en" or "eng"), or a locale name without encoding (e.g. "en_US"). Locale names and language codes are not interchangeable, e.g. the values for "de" and "de_DE" are separated. If not defined, the locale/language of the process will be used. Ignored if the attribute is not translated.

Throws:

If an invalid language was specified

Type
$k.exception.InvalidLanguage
Returns:
Type: 
string

toUTCDate() → {Date}

Returns the date/time as a Javascript date object. Assumes that this is an UTC date/time

Returns:
Type: 
Date

valueOf() → {number}

Returns the internal millisecond value. Allows comparing date/time values, since the comparision operators call valueOf()

Returns:
Type: 
number

valueString(languageopt) → {string}

Returns the string representation

Parameters:
NameTypeAttributesDescription
languagestring<optional>

Either an ISO 639-1 or ISO 639-2B language code (e.g. "en" or "eng"), or a locale name without encoding (e.g. "en_US"). Locale names and language codes are not interchangeable, e.g. the values for "de" and "de_DE" are separated. If not defined, the locale/language of the process will be used. Ignored if the attribute is not translated.

Throws:

If an invalid language was specified

Type
$k.exception.InvalidLanguage
Returns:
Type: 
string