Format date in flow designer

Erica2
Tera Contributor

Hello,

I'm currently encountering an issue where the date displays on the ritm description like this:

 

Erica2_0-1698892089059.png

 

The date value comes from date variable in the flow designer:

 

Erica2_1-1698892206868.png

 

I need help on switch it from 2024-06-30 to 06-30-2024 format.

 

Thank you

 

 

 

1 ACCEPTED SOLUTION

Hi @Erica2 

Try the script below.

 

var dt = fd_data._1__get_catalog_variables.recording_ends_date;

 

var gd = new GlideDate();

gd.setValue(dt);

return "Recording on:" + gd.getByFormat('MM-dd-YYYY');

 

Please mark my answer helpful and accept as solution if it helped 👍

Thanks,
Anvesh

View solution in original post

7 REPLIES 7

Hi @Amit Gujarathi 

Thank you for sending the video.  However, after viewing the video, I'm still did not get it.

How do you make it work using the follow code?

 
var gd = new GlideDate(fd_data._1__get_catalog_variables.recording_ends_date);
return gd.getByFormat('MM-dd-YYYY');

 

@Erica2 GlideDate can not be initialised this way, you need to use setValue() on the object. Please see my another reply for the full script.

Thanks,
Anvesh

Ankur Bawiskar
Tera Patron
Tera Patron

@Erica2 

try script shared by Anvesh

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader