
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert dates from yyyy-mm-dd and yyyymmdd to mm-dd-yyy
Hi,
I have a date field , and the dates are displayed in the yyyy-mm-dd and yyyymmdd format I need to convert it into one format ie mm-dd-yyy in the script editor
Thx
B
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try this
alt(date#(MyDateField, 'YYYY-MM-DD'), date#(MyDateField, 'DD-MM-YYYY'), date#(MyDateField, 'DD/MM/YYYY'), 'No Date Found') AS
MyDateField
Thx
MS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try > date(datefield, 'MM-DD-YYYY')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks nick for the reply
I know the following can be used
date(date#(MyDateField,'yyyymmdd'),'yyyy-mm-dd')
My questions is there a better way to do this when the filed contains dates in different formats


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try this
alt(date#(MyDateField, 'YYYY-MM-DD'), date#(MyDateField, 'DD-MM-YYYY'), date#(MyDateField, 'DD/MM/YYYY'), 'No Date Found') AS
MyDateField
Thx
MS

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try with Alt() and Date#()
Date(Alt(Date#(DateFieldName, 'yyyy-mm-dd'), Date#(DateFieldName, 'yyyymmdd')), 'mm-dd-yyy')
Regards,
Jagan.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Balraj,
If you are very sure that there are two types of dates in your data and they are in the format you mentioned, then this solution will work for you.
Let us know if this helps you
