monster.util.gregorianToDate()
Syntax
monster.util.gregorianToDate(timestamp);
Parameters
| Key | Description | Type | Default | Required |
|---|---|---|---|---|
timestamp | Gregorian timestamp representing a date. | Number | true |
Return value
A Date instance.
Errors
'timestamp' is not a valid Number:timestampisNaNor of a type other thanNumber
Description
The monster.util.gregorianToDate() method converts a Gregorian timestamp into a Date instance.
To preserve legacy behavior, if timestamp is of type String the method will try to coerce it into a Number but it is not recommended to rely on this behavior.
Examples
Convert a Gregorian timestamp into a Date instance
var timestamp = 63113932800;
monster.util.gregorianToDate(timestamp);
// output: Sat Jan 01 2000 00:00:00 GMT-0800 (Pacific Standard Time)