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: 
madhubabum
Creator
Creator

How to Convert Date format

Hi All

I have the following date format (MM.DD.YYYY) , Here i need to Change the Separator from '.' To '/' (How to get this)

Ex:

     Date_Field,

     6.25.2010,

     1.29.2011,

     12.21.2013,

Needed OutPut :

     Date_Field,

      6/25/2010,

     1/29/2011,

     12/21/2013,

Labels (1)
1 Solution

Accepted Solutions
robert_mika
MVP
MVP

Replace( Date_Field,'.','/') as Date_Field,

View solution in original post

9 Replies
sunny_talwar
MVP
MVP

Try this:

Date(Date#(Date_Field), 'MM.DD.YYYY'), 'MM/DD/YYY') as Date_Field

Date(Date#(Date_Field, 'MM.DD.YYYY'), 'MM/DD/YYYY') as Date_Field


Script:


Table:

LOAD *,

  Date(Date#(Date_Field, 'MM.DD.YYYY'), 'MM/DD/YYYY') as New_Date_Field;

LOAD * Inline [

Date_Field

6.25.2010

1.29.2011

12.21.2013

];

Output:


Capture.PNG

robert_mika
MVP
MVP

Replace( Date_Field,'.','/') as Date_Field,

Anonymous
Not applicable

Hi Madhu,

Try

replace(Date_Field,'.','/')

tresB
Champion III
Champion III

Small error of parenthesis. Correct one is:

Date(Date#(Date_Field, 'MM.DD.YYYY'), 'MM/DD/YYYY') as Date_Field

sunny_talwar
MVP
MVP

... I did see it when I was testing it

sunny_talwar
MVP
MVP

Found another one YYYY instead of YYY

tresB
Champion III
Champion III

It's just a casual error ! happens to everybody.

sunny_talwar
MVP
MVP

I agree, but happens to me more often than not. I am better off testing things rather than just answering them top of my head because I make way to much silly mistakes when it is from top of my head.

tresB
Champion III
Champion III

This way you get the right output technically - true. However, the approach should not be recommended. This way you are making the date field a string rather than a dual (numeric at the backend). Thus, this field would fall sort in the front-end for any date function direct use or so. Better to use Date(Date#(... as shown above.

Hope that makes sense.