how to convert date format to dd-mmm-yyyy in virtual agent.

kamer
Kilo Expert

Hi Team,

I have a requirement to display date into DD-MMM-YYYY format in email notification from virtual agent.

By default it is giving YYYY-MM-DD.

find_real_file.png

1 ACCEPTED SOLUTION

Imam Pasha1
Giga Guru

Hi Kamer,

I tried this code and working fine for as per your requirement what i understood.Please find the below code snippet

 

var startDate = vaInputs.start_date;  // start_date is input control name
var df = 'yyyy-MM-dd';
var gdt = new GlideDateTime(startDate);
gdt.setDisplayValue(startDate.df);
var localedt =gdt.getLocalDate();
var getStart= localedt.getByFormat('dd-MMM-yyyy');

 

 

output:

input from user:2020-03-30

output:30-Mar-2020

 

Hope this is helpful and please mark if you find the appropriate solution.

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

please check whether below link helps:

https://docs.servicenow.com/bundle/orlando-performance-analytics-and-reporting/page/administer/virtu...

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hemant Goldar
Mega Sage
Mega Sage

Hi kamer,

 

This is what I found in ServiceNow Docs(Newyork Version)

https://docs.servicenow.com/bundle/newyork-performance-analytics-and-reporting/page/administer/virtu...

 

Please mark reply as Helpful/Correct, if applicable.

 

Kind Regards,

Hemant

 

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Not possible, and aint going to happen. I had a HI case for this, and was closed 😞 They are not going to change this.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Mark Roethof
Tera Patron
Tera Patron

And here some case details:

Virtual Agent - User Input "Date/time" - Format not right in Dutch

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn