how to split date time in email notification

Ravi Singh
Tera Expert

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

2 ACCEPTED SOLUTIONS

Tony Chatfield1
Kilo Patron

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.

View solution in original post

Ravi Singh
Tera Expert

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)

View solution in original post

2 REPLIES 2

Tony Chatfield1
Kilo Patron

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.

Ravi Singh
Tera Expert

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)