![]() You start with a UTC base date other than "now", using Date.UTC() newDate = new Date(Date.UTC(2015, 3, 1)). Syntax: tDate ( newDate ) Parameters: newDate: Integer value between 1 to 31. You want the UTC date 5 days ago from NOW (UTC) var newDate = Date.now() + -5*24*3600*1000 // date 5 days ago in milliseconds UTC The JavaScript date setDate () method sets the date value for the particular date on the basis of local time. However, it works if you're doing your math all in UTC, egĪ. The setDate function is called on a Date. toString() which returns the local date and therefore is incompatible with the Date.now() base date in UTC. setDate() returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC until the updated time.
0 Comments
Leave a Reply. |