Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
cclayford
Partner - Creator
Partner - Creator

Convert to date format

Hi all

Please can you show me how to convert the following date format so that i can have the "Year", and "Month" functions:

Mon Mar 01 22:19:49 +0000 2010

Many thanks,

Christopher

1 Solution

Accepted Solutions
Not applicable

Hi Christopher,

     Except of the week day, that is redundant, the rest of timestamp components can be converted with the Timestamp() function using the correct format code. Thus, I have used Mid() function to remove the first weekday characters, and then converted to a Timestamp() type:

=Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY')

     If you want to work with this field to extract other date or time components, then try this:

Month(Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY'))

or

Year(Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY'))

View solution in original post

3 Replies
Not applicable

hi

try this it work fine

date(date#('Mar 01 22:19:49 2010','MMM DD hh:mm:ss YYYY'),'M/D/YYYY h mm ss') as dd

er_mohit
Master II
Master II

hii

try this

date(floor(timestamp#(replace(DATEFIELD,' ',' '),'mmm dd yyy h:mm:tt')),'DD/MM/YYYY')AS NEW_DATE_FIELD

Not applicable

Hi Christopher,

     Except of the week day, that is redundant, the rest of timestamp components can be converted with the Timestamp() function using the correct format code. Thus, I have used Mid() function to remove the first weekday characters, and then converted to a Timestamp() type:

=Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY')

     If you want to work with this field to extract other date or time components, then try this:

Month(Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY'))

or

Year(Timestamp#(Mid('lun Mar 01 22:19:49 +0000 2010', 5), 'MMM DD hh:mm:ss +ffff YYYY'))