new $k.DateTime(value, month, day, hours, minutes, seconds)
Constructs a DateTime from the argument(s), which can be a Date object, undefined, milliseconds (UTC) or component values.
If undefined, the current date and time is returned
| Name | Type | Description | 
|---|---|---|
value | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Date or year  | 
        |
month | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Month number  | 
        |
day | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Day number  | 
        |
hours | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Hours  | 
        |
minutes | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Minutes  | 
        |
seconds | 
            
            
            
                
                    
                        optional
                    
                    
                        
                    
                
                 Seconds Represents a date and time without timezone  | 
        
Methods
static$k.DateTime.parse(string, language)
Parse the date/time string. Both ISO 8601 and localized strings are supported.
| Name | Type | Description | 
|---|---|---|
string | 
            
            
            string | 
                
                    
                    
                        
                    
                
                 The string representation  | 
        
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.InvalidLanguage | If an invalid language was specified  | 
            
| $k.exception.InvalidValue | If value is invalid  | 
            
Returns:
The parsed date/timeequals() : boolean
Returns true if the values are equal
Returns:
| Type | Description | 
|---|---|
| boolean | 
getDayNumber() : number
Returns the number of the day, e.g. 18 for 2011-03-18
Returns:
| Type | Description | 
|---|---|
| number | 
getHours() : number
Returns the hours
Returns:
| Type | Description | 
|---|---|
| number | 
getMinutes() : number
Returns the minutes
Returns:
| Type | Description | 
|---|---|
| number | 
getMonthNumber() : number
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:
| Type | Description | 
|---|---|
| number | 
getSeconds() : number
Returns the seconds
Returns:
| Type | Description | 
|---|---|
| number | 
getYear() : number
Returns the full year
Returns:
| Type | Description | 
|---|---|
| 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 | Description | 
|---|---|
| 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 | Description | 
|---|---|
| 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 | Description | 
|---|---|
| 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 | Description | 
|---|---|
| Date | 
setDayNumber(day)
Sets the number of the day, e.g. 23 for 2012-05-23
| Name | Type | Description | 
|---|---|---|
day | 
            
            
            number | 
setHours(hours)
Sets the hours
| Name | Type | Description | 
|---|---|---|
hours | 
            
            
            number | 
setMinutes(minutes)
Sets the minutes.
| Name | Type | Description | 
|---|---|---|
minutes | 
            
            
            number | 
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.
| Name | Type | Description | 
|---|---|---|
month | 
            
            
            number | 
setSeconds(seconds)
Sets the seconds.
| Name | Type | Description | 
|---|---|---|
seconds | 
            
            
            number | 
setYear(year)
Sets the full year. The year is not modified, so setYear(99) sets the year 99, not 1999.
| Name | Type | Description | 
|---|---|---|
year | 
            
            
            number | 
toDate() : Date
Returns the date/time as a Javascript date object.
Assumes that this is a date/time of the local timezone
Returns:
| Type | Description | 
|---|---|
| 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 )
- See:
 
toString(language) : string
Returns the string representation. Equivalent to valueString()
| Name | Type | Description | 
|---|---|---|
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.InvalidLanguage | If an invalid language was specified  | 
            
Returns:
| Type | Description | 
|---|---|
| string | 
toUTC()
Returns the date/time as a UTC date/time
Assumes that this is a local date/time
- Since:
 - 4.1.0
 
toUTCDate() : Date
Returns the date/time as a Javascript date object.
Assumes that this is an UTC date/time
Returns:
| Type | Description | 
|---|---|
| Date | 
valueOf() : number
Returns the internal millisecond value. Allows comparing date/time values, since the comparision operators call valueOf()
Returns:
| Type | Description | 
|---|---|
| number | 
valueString(language) : string
Returns the string representation
| Name | Type | Description | 
|---|---|---|
language | 
            
            
            string | 
                
                    
                        optional
                    
                    
                        
                    
                
                 Language of the value. Either ISO 639-1 (2-letter code, e.g. "en") or ISO 639-2B (3-letter code, e.g. "eng"). If not defined, the current language will be used.  | 
        
Throws:
| Type | Description | 
|---|---|
| $k.exception.InvalidLanguage | If an invalid language was specified  | 
            
Returns:
| Type | Description | 
|---|---|
| string |