- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2020 05:51 AM
Hello,
I am trying to change a new glide date format to dd/mm/yyyy before changing it to a string. So far my code is not working, what am I missing?
var gdt = new GlideDate();
gdt.getByFormat("dd-MM-yyyy");
var startOfPeriod = gdt.toString();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2020 06:06 AM
Hi there,
This works for me:
var gdt = new GlideDate();
gs.info(gdt.getByFormat('dd-MM-YYYY'));
Outputs: 22-03-2020
This also works:
var gdt = new GlideDate();
var startOfPeriod = gdt.getByFormat('dd-MM-YYYY').toString();
gs.info(startOfPeriod);
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2020 06:06 AM
Hi there,
This works for me:
var gdt = new GlideDate();
gs.info(gdt.getByFormat('dd-MM-YYYY'));
Outputs: 22-03-2020
This also works:
var gdt = new GlideDate();
var startOfPeriod = gdt.getByFormat('dd-MM-YYYY').toString();
gs.info(startOfPeriod);
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