Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

String to Date format (in script)

Hi there,

I've checked various posts, but I just can't find the answer, so I do apologise if the answer is already posted somewhere... please link if appropriate.

I have a number of date columns which are in a string format of 'dd-Mmm-yyyy'... I would like to have the script convert the string to a date format, so that I don't need to play around with values within the document itself, unless of course someone thinks differently??

I appreciate any help you have on this...

Regards

Andrew

1 Solution

Accepted Solutions
sridhar240784
Creator III
Creator III

If i understood your question properly, You could use Date#() to convert Strings to dates.

Sample code would be as follows.

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

if you have time stamp in you table, you use TimeStamp#() to conver the string to timestamp

Hope this helps you.

-Sridhar

View solution in original post

2 Replies
sridhar240784
Creator III
Creator III

If i understood your question properly, You could use Date#() to convert Strings to dates.

Sample code would be as follows.

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

if you have time stamp in you table, you use TimeStamp#() to conver the string to timestamp

Hope this helps you.

-Sridhar

Not applicable
Author

Thanks Sridhar,

I was playing with the Date# function, but never thought to add the Date function around it (Ooops)...

I amended the format to 'dd-Mmm-yyyy' which works perfectly.

Regards

Andrew