gs.beginningOfThisMonth(), show a difference of 1 hour.

vikrantsharma
Kilo Guru

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

Please make it correct or helpful if this solves or help you with your issue for other to make use it.

Thanks & Regards,
Vikrant Sharma
1 ACCEPTED SOLUTION

But this method returns date and time for the begining of this month in GMT

 

find_real_file.png

-Anurag

View solution in original post

10 REPLIES 10

Omkar Mone
Mega Sage

Hi 

I just worked the above code and its giving me the correct response.

find_real_file.png

 

Thanks.

Thanks Omkar, But why it is giving you 07:00:00, shouldn't it be 2018-07-01 00:00:00?

 

Regards,

Vikrant Sharma

Please make it correct or helpful if this solves or help you with your issue for other to make use it.

Thanks & Regards,
Vikrant Sharma

Shweta KHAJAPUR
Tera Guru

check once the time zone selected.

find_real_file.png

Shweta KHAJAPUR
Tera Guru

select time zone to us/pacific or GMT and try once.