Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SK28
Creator II
Creator II

multiple date formats to be converted into single format

Hi I have 4 date formats, and there might be chance of adding new format in the date column all need to be converted into 'MM/DD/YYYY' format

date_e:
12/20/2025
12.20.2025

20.12.2025
20-01-2025
20-01-2025 12:12:11
20/12/2025 12;12:11

All the above needs to be converted into 'MM/DD/YYYY' format, is there a way doing this

4 Replies
BrunPierre
Partner - Master II
Partner - Master II

Date(
Alt(
Date#(date_e,'MM/DD/YYYY'),
Date#(date_e,'MM.DD.YYYY'),
Date#(date_e,'DD.MM.YYYY'),
Date#(date_e,'DD-MM-YYYY'),
Floor(TimeStamp#(date_e,'DD-MM-YYYY hh:mm:ss')),
Floor(TimeStamp#(date_e,'DD/MM/YYYY hh:mm:ss')),
)
,'MM/DD/YYYY')

SK28
Creator II
Creator II
Author

Hi thanks @BrunPierre this covers only the above specific formats,is there is any other way that formats the above date fields into 'MM/DD/YYYY'

 

If for example MM.DD.YYYY, if that formats has been added to the dataset,every time we needto add that logic date# logic to that formats, can we have a single solution for all the date formats please @BrunPierre 

BrunPierre
Partner - Master II
Partner - Master II

You may have to standardize the date formats in your source data. This way, Qlik always receives dates in a single, consistent format.

or

If your dates are consistently in the order of month, day, and year across your dataset, you can use the following workaround

Date(
Date#(
Replace(Replace(date_e, '.', '/'), '-', '/'),
'MM/DD/YYYY'
),
'MM/DD/YYYY'
)

Chanty4u
MVP
MVP

Try this 

Data:

LOAD 

    Date(Alt(

        Date#(date_e, 'MM/DD/YYYY'),

        Date#(date_e, 'MM.DD.YYYY'),

        Date#(date_e, 'DD.MM.YYYY'),

        Date#(date_e, 'DD-MM-YYYY'),

        Date#(date_e, 'DD-MM-YYYY hh:mm:ss'),

        Date#(date_e, 'DD/MM/YYYY hh:mm:ss')

    ), 'MM/DD/YYYY') AS FormattedDate

FROM Source;