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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
peele87
Contributor
Contributor

Multiple date formats

Just wondering if there is any script that will help me distinguish European date format ddmmyyyy from US date format mmddyyyy? I have an excel document with a date column that contains the two formats(the column itself is formatted as general). Instead of changing excel, is there qlikview script that would allow me to create a new field containing a single format? Thanks.

Labels (1)
3 Replies
deepanshuSh
Creator III
Creator III

Maybe something like this, 

If (date#(date_column, 'ddmmyyyy')='ddmmyyyy', Date(date#(date_column, 'ddmmyyyy'),

date(date#(date_column,'mmddyyyy'))) as Date_new_column

if you want to separate the two different formated dates into a different fields just use it as separately.

Trial and error is the key to get unexpected results.
henrikalmen
Specialist II
Specialist II

It’s impossible. There’s no way of knowing if 02032023 is ddmmyyyy or mmddyyyy, without having more data (like country). 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

As @henrikalmen stated it is impossible given a single date value that could be interpreted either way.  However sometimes we can rely on having dates -- such as month end -- in our data that are unambiguous.  If you know that all dates in a file use the same format you can use the unambiguous date to determine your format. 

What are your date values like? Are they mixed format? If so you are probably out of luck. If a single format per file, can you be sure there will always be a date that is later than day 12?

-Rob