Get Date in DD-MM-YYYY HH-MM-SS format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2019 06:01 AM
var created_on_date = gr.getValue('sys_created_on');
I want to convert created_on_date in DD-MM-YYYY HH-MM-SS format
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2019 06:04 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2019 06:20 AM
Hmmm 26 days ago, you asked almost the same question. What is different?
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2019 06:57 AM
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);