Changing date format in Service Portal Catalog Item Variable from "dd/MM/yyyy" to "MM/dd/yyyy"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 05:11 PM
Hello. I have a catalog item that has a variable date field called Expected Date (expected_date) where it inputs a date with the default format of "DD/MM/YYYY".
I want to make it so that the default value and any other value inputted in this field is always in a "MM/DD/YYYY" format without the need to change the System Property of the date format in the instance.
Is there any way to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 09:15 PM
Hi,
You can use the below format :
var date= new GlideDate();
gs.info(date.getByFormat('MM-dd-YYYY'));
Please mark this as correct and helpful if it resolves the query or leads you in the right direction.
Thanks,
Kathiresan S
Thanks,
Kathiresan S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 09:25 PM
Hey Kat. Where should I put this specific code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2024 04:12 AM
In the catalog client script
Thanks,
Kathiresan S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 09:24 PM
Hi @Von Naval , Have a look at this post. Date Format Change to "dd-mm-yyyy" for catalog item variable
Please go through the above script and change according to the your requirement.
Let us know if you are facing any issue
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thank you