How gs.endOfToday Works ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2013 04:43 AM
Hi All,
was trying to find out how exactly this gs.endOfToday() function works
wiki says >>>>>>>>>>>>>
2.28 endOfToday()
Gets the date and time for the end of today in GMT.
.................................................
following is the output of this
gs.print(gs.endOfToday()); ============= >>>>>>> *** Script: 2013-05-27 18:29:59
gs.print(new Date()); ================= >>>>>>> *** Script: Mon May 27 2013 13:36:09 GMT+0200 (CEST)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2013 05:16 AM
The idea : gs.endOfToday() gives you the end of today in GMT - Convert this to the time zone your server is on, which gives you end of day at the place your server is located, Which is same as if you add 24 hours to new Date();
example :
gs.print(new Date()) ==> Mon May 27 2013 05:08:34 GMT-0700 (PDT)
gs.print(gs.endOfToday) ==> 2013-05-28 06:59:59
If you convert 2013-05-28 06:59:59 which is in GMT to a place something like seattle( I guess my server is located somewhere there) ==> Seattle (U.S.A. - Washington)Monday, 27 May 2013, 23:59:00PDTUTC-7 hours
So that is the end of today.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2013 10:16 PM
i kind of thought the same - BUT if u see my output (taken from a on-premise instance) it still doesn't add up
- when i have taken the new date value which is the server time
- it says Mon May 27 2013 13:36:09 GMT+0200 (CEST) which is in turn tells me it is in Zurich
- now considering DST there is 2 hours difference at the moment
- the endoftoday gives me at the same instance 2013-05-27 18:29:59
- now if u convert this into zurich server time it can not be close to end of today at all
- so ! am still not convinced ; although thanks for the response - any further idea would be greatly appreciated 🙂