I don't understand the difference between Glide Date Time and Glide Date.

Ereshkigal
Tera Contributor

Hi.

Please tell me the difference between Glide Date Time and Glide Date as a coding beginner.

As far as I can tell, I think it's related to getting the timezone, but I'm not sure.

Also, I feel that GlideDateTime is basically used. Is there a good case where GlideDateTime is bad and GlideDate is good?

Thank you!

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I would suggest you to go through the developer site and you would find lots of examples for this

GlideDate   -> for Date calculations

GlideDateTime -> for Date/Time calculations

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thank you for linking to the developer site.

So, is there a best practice, such as which is better to use GlideDateTime or GlideDate when doing date calculations?

Thank you!

Hi,

Each class has it's own set of methods.

Based on your requirements you can use them accordingly.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ereshkigal 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Sorry for the late reply.

I didn't know what kind of time it would be if I used GlideDate instead of GlideDateTime, even if I checked the materials that cooperated with me.

If you don't mind, could you tell me if there is an example of using GlideDate?

Thank you!