Hi All,
I have dates in my data in the following two formats: yyyy-mm-dd and dd/mm/yyyy. They are in the same column and data type is string.
I want to change both of these into dd-mm-yyyy format.
I tried using formula tool but that omits one of the above formats and gives null for those. DateTime tool is also not giving the required result.
How to do it in a simple way so that dates in both the above formats change to the required format and don't give null values?
Solved! Go to Solution.
Hi @Dheeru28 you will need to parse your dates twice given you have two formats. You could wrap this in a conditonal statement first testting for the format then parsing it. I have mocked up an approach which showcases one way to tackle this.
hey @Dheeru28 you could use this expression:
IIF(Contains([Date], '/'),
DateTimeFormat(DateTimeParse([Date], '%d/%m/%Y'), '%d-%m-%Y'),
DateTimeFormat(DateTimeParse([Date], '%Y-%m-%d'), '%d-%m-%Y'))
I have dates in my data in the following two formats: yyyy-mm-dd and dd/mm/yyyy. If the formats yyyy-mm-dd and dd/mm/yyyy is the only formats , u just need the tool DateTime in Parse 。
Choose String to Date/Time format
It will be done easily.
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |