
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 01:00 AM
Hi All,
I have been coding a Script Include, in which I am using gs.beginningOfThisMonth(). However, I could see that the script was not executing correctly, on investigating it further, I found that there is a difference of 1 hour when I use gs.beginningOfThisMonth().
The instance in on Europe/London, and if I use gs.nowDateTime() in the script it works fine.
For testing purpose, I am using the below script and getting the result as shown, and we are on Kingston patch 7.
Has anyone else noticed the same behavior?
gs.log("Beginning of the month: "+gs.beginningOfThisMonth());
gs.log("Get the current time: "+gs.nowDateTime());
*** Script: Beginning of the month: 2018-06-30 23:00:00 // This should be 2018-07-01 00:00:00
*** Script: Get the current time: 23/07/2018 08:57:13 // This is the correct time.
Regards,
Vikrant Sharma
Thanks & Regards,
Vikrant Sharma
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 02:54 AM
But this method returns date and time for the begining of this month in GMT

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 02:14 AM
Thanks Shweta, We are on Europe/London, GMT doesn't consider daylight saving time. Everywhere else the time is fine, even while using other Date time functions, I have only noticed it while using beginningOfThisMonth
Thanks & Regards,
Vikrant Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 02:14 AM
That is probably beause of timezones, difference between GMT and UTC. London is on BST at this time of the year.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 02:16 AM
Thanks Anurag, But I don't have any issue with the nowDateTime() function. It given me an hours difference with beginningOfThisMonth().
Thanks & Regards,
Vikrant Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 02:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 06:03 AM
Thanks Aurag, That makes sense as it suggest and correct me if I am wrong, that it should return the result in GMT, regardless of the system property? And, if I set the system property as GMT, instead of Europe / London, the results are below:
*** Script: Beginning of the month: 2018-07-01 00:00:00
*** Script: Get the current time: 23/07/2018 12:50:12
The current time goes out of sync, which makes sense, as GMT would be 1 hour behind BST(British Summer Time).
Cheers.
Thanks & Regards,
Vikrant Sharma