.toString()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 01:02 PM
Hi All,
Looking for help to convert datetime value to string format - "xx hours xx mits"
in my flow create record, for a field I have scripted
" return fd_data.trigger.current.u_start_time.toString(); "
this returns - 2023-10-02 20:50:53
my requirement is to return like : 3 Hours 39 Minutes
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 01:23 PM
Hi, unfortunately your post does not make your requirements clear, are you looking to show the start time based on local user time, or the time left until start time?
For start time in local time I suspect you would need to instantiate a GlideDateTime object and return a localized date\time value and then substring the results to get the format that you are looking for.
But exactly what and how will depend on your flow configuration. Perhaps this would be a good starting point
GlideDateTime | ServiceNow Developers
Similarly, if wanting to show time left until start time you could use GlideDateTime subtract current time from start time, then format the result.