Missing DateTime Functions?

G24
Kilo Sage

Hello Gurus,  I have had tremendous difficulty lately working with GlideDateTime values, documented here.

 

I finally understood that the two main "variables" for what gets returned by these functions are the "Format" you want the output in, and the "Timezone" you want the output in.  But there is no consistency in the names...

 

I had to make a spreadsheet to try and sort it all out, but some things seem to be missing:

GlideDateTimeScreenshot.png

 

Questions:

1)  Is there a function which does what "missingFunctionOne" does?  Provides the Time ONLY in internal format and system timezone?  (See cell D5)

2)  Is there a function which does what "missingFunctionTwo" should do?  Provide the Date ONLY in user format and user timezone? (See cell D17).

 

Thank you for any help you can provide.

1 REPLY 1

Weird
Mega Sage

For time I think there's no option to just get it alone, but you can always just parse it out of the GlideDateTime by splitting the resulting value. For example 2023-08-29 04 04:23:45 would be split where the space is and then index 1 would contain just the time. I assume it's because GlideDateTime handles both Date and Time so it makes sense for it to always return some date.

There's another class called Date and that can be used for just the date and probably has the functions you need.
GlideDate | ServiceNow Developers