Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
cclayford
Partner - Creator
Partner - Creator

Coverting string value to date.

Hi all

How do i convert this string value:

16/01/2011 12:13:52

into a date?

The goal is to be able to have Year, month, and Year/Month values.

1 Solution

Accepted Solutions
Anonymous
Not applicable

first, format it as a proper timestamp:

timestamp#(FIELDNAME, 'DD/MM/YYYY hh:mm:ss')

Then you can apply any date functions on it, like year() for example:

year(timestamp#(FIELDNAME, 'DD/MM/YYYY hh:mm:ss')) as Year

View solution in original post

3 Replies
Anonymous
Not applicable

first, format it as a proper timestamp:

timestamp#(FIELDNAME, 'DD/MM/YYYY hh:mm:ss')

Then you can apply any date functions on it, like year() for example:

year(timestamp#(FIELDNAME, 'DD/MM/YYYY hh:mm:ss')) as Year

cclayford
Partner - Creator
Partner - Creator
Author

Thanks Johannes, it worked

Is there any way i can get a month/year format?

Eg. Jan-2012

Anonymous
Not applicable

Sure is.

Instead of Year() use, MonthStart() and then add a Date() around the Monthstart function and format the string with just the month and year, 'MMM-YYYY'.