Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date

Hi All,

i have a date formate of this type  CD(2014-06-10 00:07:51.63) . I wanted to know how do i get the month and year out of this .

I tried with the following expression but its not working year(CD) as year .

Thanks in Advance

1 Solution

Accepted Solutions
PrashantSangle

Hi,

Try like this,

year(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff'))  as Year

Month(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as Month,

MonthName(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as MonthName,

Day(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as Day,

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

5 Replies
its_anandrjs

Hi,

Try this ways

Tab1:
LOAD Datetime,
Mid(Datetime,4,4) as Year,
Mid(Datetime,9,2) as Month,
Mid(Datetime,12,2) as Day;
LOAD * INLINE [
Datetime
CD(2014-06-10 00:07:51.63)
];

Here i assume  Mid(Datetime,9,2) as Month, Mid(Datetime,12,2) as Day

Regards

Anand

anbu1984
Master III
Master III

Is CD field name? Then change arguments in Anand's code

Tab1:

LOAD Datetime,

Mid(Datetime,1,4) as Year,

Mid(Datetime,6,2) as Month,

Mid(Datetime,9,2) as Day;

LOAD * INLINE [

Datetime

2014-06-10 00:07:51.63

];

PrashantSangle

Hi,

Try like this,

year(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff'))  as Year

Month(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as Month,

MonthName(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as MonthName,

Day(TIMESTAMP#(PurgeChar('CD(2014-06-10 00:07:51.63)','CD()'),'YYYY-MM-DD hh:mm:ss.ff')) as Day,

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

hi max dreamer you rock man

its_anandrjs

Hi Wrestler,

Please open single thread for the same question.

This is your open thread

http://community.qlik.com/message/678949#678949

Regards

Anand