Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show date's month name instead of number

DevYadav
Tera Contributor

Hi All,

Good Day!!!!

there is a variable name "date" [u_date] in catalog item. It is showing format as [yyyy--mm-dd].

I want to change it's format from above to February8th,2023.

 

Thanks 

11 REPLIES 11

Hello @DevYadav 

 

Plz check the same Script it is Giving me the Format as per expectations.

 

    var gdt1 = g_form.getValue('u_date');
    var newDate = gdt1.getByFormat("MMMM dd,YYYY");
    return newDate;

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

Hi @Samaksh Wani, i've try the above code. it is showing correct format like, it is displaying month' number then date and then year. but i want to display month's name here

DevYadav_0-1689945634543.png

 

Hello @DevYadav 

 

You need to Write the OnChange Client Script like that on the Date field.

 

 

var date = g_form.getValue('date_field');
var newDate = date.getByFormat("MMMM dd, YYYY");
g_form.setValue('date_field', newDate);

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

Hi @Samaksh Wani, i've try your code, but it is not displaying the month's in catalog client script 

Hello @DevYadav 

 

Plz check the screenshot with the same script as per your expectations.

Screenshot 2023-07-21 at 6.46.51 PM.png