Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
vinod1992
Contributor
Contributor

Convert string to date

Hi All,

I have string format as jan'19, How to convert that string into date format?

Thanks & Regards,

Vinod

1 Solution

Accepted Solutions
crusader_
Partner - Specialist
Partner - Specialist

Hi,

First thing to do is replace ' symbol with something neutral like -, then apply DATE#() function to tell Qlik explicitly that this text is a date. You should get something like below.

DATE#( REPLACE(<YourField>,chr(39), '-'), 'MMM-YY')  AS <YourDateField>

You can additionally apply DATE() function on top to convert to your default date format, also note that your Jan'19 will be 01/01/2019.

Hope this helps.

//Andrei

View solution in original post

9 Replies
crusader_
Partner - Specialist
Partner - Specialist

Hi,

First thing to do is replace ' symbol with something neutral like -, then apply DATE#() function to tell Qlik explicitly that this text is a date. You should get something like below.

DATE#( REPLACE(<YourField>,chr(39), '-'), 'MMM-YY')  AS <YourDateField>

You can additionally apply DATE() function on top to convert to your default date format, also note that your Jan'19 will be 01/01/2019.

Hope this helps.

//Andrei

Channa
Specialist III
Specialist III

date(date,'MMM YY')

date(date#(date,'MMM YY'),'MMM YY')

try

Channa
Shubham_Deshmukh
Specialist
Specialist

Hi Vinod,

You need to replace ' with - first and then you can proceed, try this : 

=Date(Date#(Replace(yourDate,chr(39),'-'),'MMM-yy'),'MM/yy')

-Shubham

tresesco
MVP
MVP

So here the single quote (') is something that is annoying you, right? If so, you could use escape sequence, like:

=Date(Date#(YouraDate, 'MMM''YY'))

Note the double single quotes in red. For better understanding, refer : Escape Sequence in Qlik

Shubham_Deshmukh
Specialist
Specialist

@tresesco ,

Thanks for the tip, it works.

 

tresesco
MVP
MVP

That means you liked it, but still didn't LIKE it..Smiley Tongue

Shubham_Deshmukh
Specialist
Specialist

Done !!
vinod1992
Contributor
Contributor
Author

Thanks Shubham It worked

Shubham_Deshmukh
Specialist
Specialist

Kudos!!