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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
madhubabu
Contributor III
Contributor III

Date function

Hi all,

I have following table;

T1:

Load * Inline [

s.no   | Date                          | Products

1      |  08/06/2013 5:53:09      | soaps

2      |  09/10/2013 9:25:09      | pens

3      | 10/11/2014 10:55:25      | pencils

4      | 11/12/2015 11:25:30      | slates

];

I want to separate the Date field as date , month, year and remaining all will be the Time.

I have to get as following table.

s.no     |      Date      |      month      |      year      |      Time       | Products

1          |      08         |      06            |      2013     |      5:53:09   | soaps

2          |      09         |      10            |      2013     |      9:25:09   | pens

3          |      10         |      11            |      2014     |      10:55:25 | pencils

4          |      11         |      12            |      2015     | 11:25:30      | slates

Thanks,

Madhu

Labels (1)
4 Replies
tresB
Champion III
Champion III

PFA

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff][TT]';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

T1:

Load *,

  Day(trim(Date)) as Date2,

  Month(Date) as Month,

  Year(Date) as Year,

  Time(Date) as Time Inline [

s.no   | Date                          | Products

1      | 08/06/2013 5:53:09      | soaps

2      | 09/10/2013 9:25:09      | pens

3      | 10/11/2014 10:55:25      | pencils

4      | 11/12/2015 11:25:30      | slates

] (delimiter is '|');

miguelbraga
Partner - Specialist III
Partner - Specialist III

Do as follow:

T1:

LOAD *,

          Day(date(floor(Date))) as Date,

          Month(date(floor(Date))) as month,

          Year(date(floor(Date))) as year,

          time(Date) as time;

Load * Inline [

s.no   | Date                          | Products

1      |  08/06/2013 5:53:09      | soaps

2      |  09/10/2013 9:25:09      | pens

3      | 10/11/2014 10:55:25      | pencils

4      | 11/12/2015 11:25:30      | slates

];

This will get your desired output

Regards,

MB

miguelbraga
Partner - Specialist III
Partner - Specialist III

See the attached file

Regards,

MB

Anonymous
Not applicable