gs.beginningOfToday() gives different values on different dates?!

Simon Ciglia1
Tera Contributor

Dear SNC,

We ran gs.beginningOfToday() on the 25.10.2020 and got the following result:

2020-10-24 22:00:00

If I ran it today (27.10.2020), I will get the following result

2020-10-26 23:00:00

 

I need to get constant results, not a time difference of 1 hour, is there a method to accomplish this?

Thank you in advance,
Simon

1 ACCEPTED SOLUTION

So how about your original question. Please follow-up on that first.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This could be due to change in time, like daylight savings time, which was again on the 25th of October. This would explain the 1 hour difference.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Akshay H Mulky
Kilo Guru

Hi Simon,

By default gs.beginningOfToday() gives GMT

Can you try this:

gs.beginningOfToday().getDisplayValue();

 

For current time you can try:

new GlideDateTime(gs.nowDateTime());

Mark Roethof
Tera Patron
Tera Patron

So what is it actually that you are after doing with this date? Do you just want the system date like you shared? Or do you actually want the local date/time? 

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Dear Mark, I need to add two values and add the current date
1970-01-01 05:00:00
1970-01-01 02:30:00

 
result should be
2020-28-10 07:30:00
 
Do you have any idea how to accomplish it?