- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 03:28 PM
Hi
i have an email notification in which i am extracting from an underlying table a date/time field which is showing dd/mm/yyyy GMT, i would like it to display either just the dd/mm/yyyy or "dd/mm/yyyy Local Time"
Can anyone help on how i can convert the current date/time to either just the date or date/time LocalTime
thanks
Ravi Singh
imravisingh@gmail.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 03:58 PM
Hi, you would normally use a notification email script and basic string methods.
Product Documentation | ServiceNow
But conversion to local time may not be possible unless you have only 1 time-zone involved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 07:36 AM - edited 06-16-2023 07:39 AM
Thanks, yes that is what i ended up using - the basic string method to split the TZ out (i would rather have been able to somehow use a method to show the Local TZ , but so far as you mention it seems that is not possible). I did it in the existing notification script by adding a new date variable and string method to split, and finally doing a template.print(updatedDate). Then in the email body i called that updatedDate to show by calling the notification script ${mail_script:<script name>}.
The remaining new question if by declaring and printing (template.print) within the mail script and then later calling from the outbout email body, is going to stop the, what the script is doing before this was introduced (probably not, but i am not yet certain about that)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 03:58 PM
Hi, you would normally use a notification email script and basic string methods.
Product Documentation | ServiceNow
But conversion to local time may not be possible unless you have only 1 time-zone involved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 07:36 AM - edited 06-16-2023 07:39 AM
Thanks, yes that is what i ended up using - the basic string method to split the TZ out (i would rather have been able to somehow use a method to show the Local TZ , but so far as you mention it seems that is not possible). I did it in the existing notification script by adding a new date variable and string method to split, and finally doing a template.print(updatedDate). Then in the email body i called that updatedDate to show by calling the notification script ${mail_script:<script name>}.
The remaining new question if by declaring and printing (template.print) within the mail script and then later calling from the outbout email body, is going to stop the, what the script is doing before this was introduced (probably not, but i am not yet certain about that)