Class $k.DateTime
Represents a date and time without timezone
- Defined in: DateTime.js
Constructor Attributes | Constructor Name and Description |
---|---|
$k.DateTime(value, month, day, hours, minutes, seconds)
Constructs a DateTime from the argument(s), which can be a Date object, undefined, or component values.
|
Method Summary
Class Detail
$k.DateTime(value, month, day, hours, minutes, seconds)
Constructs a DateTime from the argument(s), which can be a Date object, undefined, or component values.
If undefined, the current date and time is returned
- Parameters:
- value Optional
- Date or year
- month Optional
- Month number
- day Optional
- Day number
- hours Optional
- Hours
- minutes Optional
- Minutes
- seconds Optional
- Seconds
Method Detail
-
{boolean} equals(value)Returns true if the values are equal
- Parameters:
- value
- Returns:
- {boolean}
-
{number} getDayNumber()Returns the number of the day, e.g. 18 for 2011-03-18
- Returns:
- {number}
-
{number} getHours()Returns the hours
- Returns:
- {number}
-
{number} getMinutes()Returns the minutes
- Returns:
- {number}
-
{number} getMonthNumber()Returns the number of the month. Unlike Date.prototype.month(), this is not the 0-based month index, so for January getMonthNumber() returns 1, not 0
- Returns:
- {number}
-
{number} getSeconds()Returns the seconds
- Returns:
- {number}
-
{number} getYear()Returns the full year
- Returns:
- {number}
-
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 date/time of the local timezone
- Returns:
- {$k.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 date/time of the local timezone
- Returns:
- {$k.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 date/time of the local timezone
- Returns:
- {$k.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:
- {$k.Date}
-
<static> $k.DateTime.parse(string, language)Parse the date/time string. Both ISO 8601 adnd localized strings are supported.
- Parameters:
- {string} string
- The string representation
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- The parsed date/time
-
setDayNumber(day)Sets the number of the day, e.g. 23 for 2012-05-23
- Parameters:
- {number} day
-
setHours(hours)Sets the hours
- Parameters:
- {number} hours
-
setMinutes(minutes)Sets the minutes.
- Parameters:
- {number} minutes
-
setMonthNumber(month)Set the number of the month. Unlike Date.prototype.month(), this is not the 0-based month index, so for January pass 1 to setMonthNumber() , not 0.
- Parameters:
- {number} month
-
setSeconds(seconds)Sets the seconds.
- Parameters:
- {number} seconds
-
setYear(year)Sets the full year. The year is not modified, so setYear(99) sets the year 99, not 1999.
- Parameters:
- {number} year
-
toDate()Returns the date/time as a Javascript date object. Assumes that this is date/time of the local timezone
-
toJSON(key)Returns a string representing the date/time, similar to Date.prototype.toJSON ( key )
- Parameters:
- key
- See:
- $k.Date#toJSON
-
{string} toString(language)Returns the string representation. Equivalent to valueString()
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- {string}
-
toUTCDate()Returns the date/time as a Javascript date object. Assumes that this is an UTC date/time
-
{string} valueString(language)Returns the string representation
- Parameters:
- {string} language Optional
- Language of the value. If not defined, the current language will be used. Ignored if the attribute is not translated
- Throws:
- {$k.exception.InvalidLanguage}
- If an invalid language was specified
- Returns:
- {string}