Library: SimileAjax.DateTime
Overview
A collection of date/time utility functions
Constructors
Functions
Takes a date object and a string containing an ISO 8601 date and sets the
the date using information parsed from the string. Note that this method
does not parse any time information.
parameters
Date | dateObject | the date object to modify |
String | string | an ISO 8601 string to parse |
returns
Date | the modified date object |
Takes a date object and a string containing an ISO 8601 time and sets the
the time using information parsed from the string. Note that this method
does not parse any date information.
parameters
Date | dateObject | the date object to modify |
String | string | an ISO 8601 string to parse |
returns
Date | the modified date object |
Takes a date object and a string containing an ISO 8601 date and time and
sets the date object using information parsed from the string.
parameters
Date | dateObject | the date object to modify |
String | string | an ISO 8601 string to parse |
returns
Date | the modified date object |
Takes a string containing an ISO 8601 date and returns a newly instantiated
date object with the parsed date and time information from the string.
parameters
String | string | an ISO 8601 string to parse |
returns
Date | a new date object created from the string |
Takes a string containing a Gregorian date and time and returns a newly
instantiated date object with the parsed date and time information from the
string. If the param is actually an instance of Date instead of a string,
simply returns the given date instead.
parameters
Object | o | an object, to either return or parse as a string |
returns
Date | the date object |
Rounds date objects down to the nearest interval or multiple of an interval.
This method modifies the given date object, converting it to the given
timezone if specified.
parameters
Date | date | the date object to round |
Number | intervalUnit | a constant, integer index specifying an interval, e.g. SimileAjax.DateTime.HOUR |
Number | timeZone | a timezone shift, given in hours |
Number | multiple | a multiple of the interval to round by |
Number | firstDayOfWeek | an integer specifying the first day of the week, 0 corresponds to Sunday, 1 to Monday, etc. |
Rounds date objects up to the nearest interval or multiple of an interval.
This method modifies the given date object, converting it to the given
timezone if specified.
parameters
Date | date | the date object to round |
Number | intervalUnit | a constant, integer index specifying an interval, e.g. SimileAjax.DateTime.HOUR |
Number | timeZone | a timezone shift, given in hours |
Number | multiple | a multiple of the interval to round by |
Number | firstDayOfWeek | an integer specifying the first day of the week, 0 corresponds to Sunday, 1 to Monday, etc. |
Increments a date object by a specified interval.
parameters
Date | date | the date object to increment |
Number | intervalUnit | a constant, integer index specifying an interval, e.g. SimileAjax.DateTime.HOUR |
Returns a new date object with the given time offset removed.
parameters
Date | date | the starting date |
Number | timeZone | a timezone specified in an hour offset to remove |
returns
Date | a new date object with the offset removed |
Returns the timezone offset of the user's browser.
returns
Number | the timezone offset in the user's locale in hours |
Objects
An array of unit lengths, expressed in milliseconds, of various lengths of
time. The array indices are predefined and stored as properties of the
SimileAjax.DateTime object, e.g. SimileAjax.DateTime.YEAR.