Missing DateTime Functions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 10:15 PM
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:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 12:49 AM
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