
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:23 AM
Hi all,
Is it possible to change the date format from:
8 September 2020
to
08/09/2020 - via a script? would then need to populate a date in a request item...
Thanks for your help
Regards
Rich
Solved! Go to Solution.
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2020 03:19 AM
Hi,
Try like this.
var termination_date = email.body.termination_date;
termination_date = termination_date.split(" ");
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul","Aug", "Sep", "Oct", "Nov", "Dec"];
//get the month
var mon = month.indexOf(termination_date[1].toString());
mon++;
var gdt1= new GlideDateTime();
gs.info("Date format is "+gdt1);
var dt = termination_date[2]+"-"+mon+"-"+termination_date[0]; //change to your system format here
var gdt = new GlideDateTime(dt);
//Now gdt contains the date in the SN format.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 07:34 AM
Hi Richard
In the email script you can change the format like below.
var gdt = new GlideDateTime(current.your_field_name); //metnion your field name here
var dt = gdt.getDate().getByFormat("dd/MM/yyyy");
template.print(dt);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2020 06:37 AM
If this has answered your question, kindly accept my comment as a correct answer so that the question is moved to the solved list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2020 02:09 AM
I see that you have marked my comment as helpful. Could you also mark it as correct so that the question is moved to the solved list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2020 02:13 AM
Hi Asifnoor,
Thanks for your reply - I dont think I explained myself properly in the original question. I'm looking to convert the date from an email into a request item via an inbound action. The email has a date field that looks like this...
And I need to convert it into 11/09/2020.
Again, thank you for your response.
Regards
Richard