Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MuraliPrasath
Creator III
Creator III

Date issue.

Hi,

I've to make Year, Month, Week, Day out of this date (date_added) field.

How to split this field and get my master calendar?

date.PNG

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi,


Try this,


Date(Date#(date_added,'MM/DD/YYYY hh:mm'),'DD/MM/YYYY') as New_Date_Field,

Year(Date#(date_added,'MM/DD/YYYY hh:mm')) as Year,

Month(Date#(date_added,'MM/DD/YYYY hh:mm')) as Month,

Day(Date#(date_added,'MM/DD/YYYY hh:mm')) as Month

and so on..

Update: I did a small correction in my solution. Sorry for the confusion.

View solution in original post

6 Replies
tamilarasu
Champion
Champion

Hi Murali,

Could you post your script here?  It would be helpful for us to provide you the better solution.

MuraliPrasath
Creator III
Creator III
Author

Hi,

I've a date field with time on it. I just need date like 'DD/MM/YYYY' format.

Currently I've a format of ex: 10/15/2016 14:19  ('MM/DD/YYYY hh:mm')

I need a proper date filed to convert later as Month, Year, Day and so on... Please see my date field example shown above.

ramasaisaksoft

hemanthaanichet
Creator III
Creator III

Hi Murali

Date: date(date#(date_added, 'MM/DD/YYYY HH:SS'), 'DD/MM/YYYY')

Year: year(date_added)

Month: date(date#(date_added, 'MM/DD/YYYY HH:SS'), 'MMM')

Week: week(date(date#(date_added, 'MM/DD/YYYY HH:SS'), 'DD-MM-YYYY')

Day: date(date#(date_added, 'MM/DD/YYYY HH:SS'), 'DD')

Regards

Hemanth

tamilarasu
Champion
Champion

Hi,


Try this,


Date(Date#(date_added,'MM/DD/YYYY hh:mm'),'DD/MM/YYYY') as New_Date_Field,

Year(Date#(date_added,'MM/DD/YYYY hh:mm')) as Year,

Month(Date#(date_added,'MM/DD/YYYY hh:mm')) as Month,

Day(Date#(date_added,'MM/DD/YYYY hh:mm')) as Month

and so on..

Update: I did a small correction in my solution. Sorry for the confusion.

Anonymous
Not applicable

Hi,

To get the date and change format you can use "floor" and "date" function

E.g.:

Load *,

       Year (date) as Year,

       Month (date) as Month,

       Week (date) as Week,

       Day(date) as Day;

Load

.........

       date_added,

       date(floor(date_added),'DD/MM/YYYY') as date,

........

From.....;