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

wanna yar and month and date


Hi i have a filed name xxxdate, and cuid, in this wanna get month and year and date in diffrent field

In the xxxdate field my date format is like this 1/1/2014 12:02:15 AM

Please let me know the answer

thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

If xxxdate contains string values use the timestamp# function to create timestamps from the strings. If your xxxdate field already contains numeric timestamps then you can use the year, month and other functions directly on the xxxdate field.


LOAD

     xxxdate,

     year(xxxdate) as Year,

     month(xxxdate) as Month,

     day(xxxdate) as Day,

     date(floor(xxxdate)) as Date,

     time(frac(xxxdate)) as Time;

LOAD

     timestamp#(xxxdate,'D/M/YYYY hh:mm:ss TT') as xxxdate

FROM ...somewhere...;


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

If xxxdate contains string values use the timestamp# function to create timestamps from the strings. If your xxxdate field already contains numeric timestamps then you can use the year, month and other functions directly on the xxxdate field.


LOAD

     xxxdate,

     year(xxxdate) as Year,

     month(xxxdate) as Month,

     day(xxxdate) as Day,

     date(floor(xxxdate)) as Date,

     time(frac(xxxdate)) as Time;

LOAD

     timestamp#(xxxdate,'D/M/YYYY hh:mm:ss TT') as xxxdate

FROM ...somewhere...;


talk is cheap, supply exceeds demand
Not applicable
Author

Hi ,

thanks for ur reply but prob is that .... date foramt is like this

8/1/2014 12:12:23 AM

int his How to do ?

ashfaq_haseeb
Champion III
Champion III

Hi,

Ckeck this

Load

Date(Date#(Date,'M/D/YYYY HH:MM:SS TT')) as PostingDate,

Year(Date#(Date,'M/D/YYYY HH:MM:SS TT')) as Year,

Month(Date#(Date,'M/D/YYYY HH:MM:SS TT')) as Month;

load * Inline

[

Date

1/1/2014 12:02:15 AM

];

Regards

ASHFAQ

Gysbert_Wassenaar

Let's try that again:


If xxxdate contains string values use the timestamp# function to create timestamps from the strings.


LOAD

     xxxdate,

     year(xxxdate) as Year,

     month(xxxdate) as Month,

     day(xxxdate) as Day,

     date(floor(xxxdate)) as Date,

     time(frac(xxxdate)) as Time;

LOAD

     timestamp#(xxxdate,'D/M/YYYY hh:mm:ss TT') as xxxdate

FROM ...somewhere...;


If your xxxdate field already contains numeric timestamps then you can use the year, month and other functions directly on the xxxdate field.


LOAD

     xxxdate,

     year(xxxdate) as Year,

     month(xxxdate) as Month,

     day(xxxdate) as Day,

     date(floor(xxxdate)) as Date,

     time(frac(xxxdate)) as Time

FROM ...somewhere...;


talk is cheap, supply exceeds demand