- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 08:55 PM
I want to convert string date (2019-MAR-22) to date format (03-22-2019).
Regards,
Rushi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 09:13 PM
Hi Rushi,
Try the below script:
Script:
var date = '2019-MAR-22';//Input Date
var gd = new GlideDate();
gd.setDisplayValue(date, "yyyy-MMM-dd");
gs.print('output '+gd.getByFormat("MM/dd/yyyy"));//Output
Output of the srcript would be :
Please mark helpful and correct.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 09:00 PM
Hey Rushi,
Here is a same thread you are looking for, it might help you:
Mark correct and helpful if you find response Worthy!!
Best Regards,
Namrata.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 09:05 PM
Try this.
var date = '2019-Mar-22';
var gdt = new GlideDateTime(date);
gdt.getDate();
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 09:10 PM
Hi Rushi
Try following script:
var date = '10 Jul 2018 12:30:00';
var simpleDateFormat = 'dd MMMM yyyy HH:mm:ss'; // Simple Date Time format
var gdt = new GlideDateTime();
gdt.setDisplayValue(date,simpleDateFormat); //Set time using current TZ
gs.addInfoMessage(gdt.getDisplayValue()); // Output time in current TZ
2018-07-10 12:30:00 PM |
If it help mark helpful or correct
Thanks and regards
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2020 09:13 PM