- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2018 03:24 PM
Not sure why I'm finding this so difficult but dates are my greatest weakness and greatly appreciate any help as I have searched endlessly and the glideDate's that I've tried have not worked.
I have an inbound script that I need to take a provided date in the body of the email notification and convert it to a different format and set it to just a string field. It is coming in as 10-Sep-2019 and needs to convert to 10/10/2019. The sender has no option to change their date format.
I know the script to apply it, without reformatting, would look like:
current.u_start_date = email.body.start_date
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 10:59 AM
Finally got it! I was doing my best to avoid what I used to have to do in the past like yours above. Thanks everyone.
var gd = new GlideDate();
gd.setDisplayValue(email.body.start_date, "dd-MMM-yyyy");
current.u_start_date = gd.getByFormat("MM/dd/yyyy");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2018 03:31 PM
Below link may help
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2018 04:52 PM
Sanjiv - I'm having a hard time connecting the dots between my ask and that article and understanding how that would help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2018 05:06 PM
Try below
var gdt = new GlideDate();
gdt.setDisplayValue('email.body.start_date', "dd-MMM-yyyy");
current.u_start_date = gdt;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 10:31 AM
Sanjiv - I had to remove the extra quotes to get it to work but the output is putting it into YYYY-DD-MM.
var gdt = new GlideDate();
gdt.setDisplayValue(email.body.start_date, "dd-MMM-yyyy");
current.u_start_date = gdt;
So it's starting as 15-Sep-2018 but outputting it as 2018-09-15 and I'm needing it to be 09/15/2018. Any other ideas?