Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
Contributor III

Re: String to Date format (in script)

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

2 Replies
sridhar240784
Contributor III

Re: String to Date format (in script)

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

String to Date format (in script)

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

Community Browser