The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Get Date in DD-MM-YYYY HH-MM-SS format

Amol J
Kilo Contributor

var created_on_date = gr.getValue('sys_created_on');

 

I want to convert created_on_date in  DD-MM-YYYY HH-MM-SS format

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

See this developer page, also includes examples:
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=c_APIRef

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

Kind regards,
Mark

---

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

Hmmm 26 days ago, you asked almost the same question. What is different?

https://community.servicenow.com/community?id=community_question&sys_id=e51e9e3b1bc50450a59033f2cd4b...

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

Kind regards,
Mark

---

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

SatheeshKumar
Kilo Sage

the below should help you!

var gr = new GlideRecord('incident');
    gr.get('cc7d9d04db8d8410b6db8e4748961944');//replace with valid id from your instance

var gdt = new GlideDateTime(gr.sys_created_on);
var gd = gdt.getLocalDate();
var gt = gdt.getLocalTime();

var fd = gd.getByFormat('dd-MM-yyy') + gt.getByFormat(' HH:mm:ss')

gs.info(fd);