Library: SimileAjax.DateTime
Overview
A collection of date/time utility functions
Constructors
Functions
SimileAjax.DateTime.setIso8601Date(dateObject, string)
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
SimileAjax.DateTime.setIso8601Time(dateObject, string)
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
SimileAjax.DateTime.setIso8601(dateObject, string)
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
SimileAjax.DateTime.parseIso8601DateTime(string)
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
SimileAjax.DateTime.parseGregorianDateTime(o)
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
SimileAjax.DateTime.roundDownToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek)
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.
SimileAjax.DateTime.roundUpToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek)
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.
SimileAjax.DateTime.incrementByInterval(date, intervalUnit)
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
SimileAjax.DateTime.removeTimeZoneOffset(date, timeZone)
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
SimileAjax.DateTime.getTimezone()
Returns the timezone offset of the user's browser.
returns
Number the timezone offset in the user's locale in hours
Objects
Array SimileAjax.DateTime.gregorianUnitLengths
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.
Number SimileAjax.DateTime.timezoneOffset
The timezone offset in minutes in the user's browser.
Generated by JsDoc Toolkit on Tue, 07 Aug 2007 20:53:47 GMT