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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewwizard
Master II
Master II

Date convert - without Alt function

How to convert the Date column to DATE format.

I tried the below code but format function Date# is not working for second record.

Please advise.

Data:

load * ,DATE(DATE#(Date#(Date,'YYYY/DD/MM'),'YYYY/MM/DD')) AS NEW_DATE;

load * inline [

Sno,Date

1,2010/31/01

2,2011/02/28

];

15 Replies
tresesco
MVP
MVP

You can get the same done using if( IsNum(.. which is actually an expanded version of alt(). Would that be of any help for you?

DATE(If( Isnum(Date#(Date,'YYYY/DD/MM')),Date#(Date,'YYYY/DD/MM'),DATE#(Date,'YYYY/MM/DD'))) AS NEW_DATE;

hemanthaanichet
Creator III
Creator III

Brother ,

Isnum() will retun either -1 or 0 whether the above will work?????

tresesco
MVP
MVP

I guess it would not take much of your time - to check if that works or not. Just try yourself  like:

Data:

load * ,DATE(If( Isnum(Date#(Date,'YYYY/DD/MM')),Date#(Date,'YYYY/DD/MM'),DATE#(Date,'YYYY/MM/DD'))) AS NEW_DATE;

load * inline [

Sno,Date

1,2010/31/01

2,2011/02/28

];

Did it work? Please let know.

hemanthaanichet
Creator III
Creator III

Brother its working if dnt mine can u pls say hw it is possible

qlikviewwizard
Master II
Master II
Author

tresesco

You are great. Thanks for the information.

Koniki
Contributor II
Contributor II

YOU ONLY TWO FORMATS MENTIONED IF THERE IS  DIFFERENT FORMATS 

HOW DID YOU WRITE THE EXPRESSIONS