Date format issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 07:32 AM
Hi,
I am trying to achieve number of days difference between a date variable (end Date) and current date. The date variable on the form is auto populated through onchange client script and it returns the date in the format yyyy-mm-dd which is fine, but then when i change the date, the date is saved in the format dd/mm/yyyy. Since the system returns the current date in yyyy-mm-dd format, finding it hard to subtract the dates which are in 2 different formats.
Is it possible to convert the date format from dd/mm/yyyy to yyyy-mm-dd or vice verse for the calculation to work?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 08:05 AM
Not sure about your code but you can do something like below to get date in format you want
var date= new GlideDate();//replace new GlideDate() with the incoming date
var date2 = date.getByFormat('yyyy/MM/dd');//now use the date2 to set the field value