Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Convert a Date into Day, Quarter, Month, Year?


Hi All,

I have date field in this format: DD-Mon-YY. For example: 24-Oct-2013.

From this I need to fetch, Day, Quarter, Month and Year.

How to do it in script level? Please help.

Regards!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Use below in your script...

Date(Date#(Date, 'DD-MMM-YYYY') ) as Date,

Month(Date#(Date, 'DD-MMM-YYYY') ) as Month,

Year(Date#(Date, 'DD-MMM-YYYY') ) as Year,

Day(Date#(Date, 'DD-MMM-YYYY') ) as Day,

'Q' & Ceil(Month(Date#(Date, 'DD-MMM-YYYY') ) /3) as Quarter

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Use below in your script...

Date(Date#(Date, 'DD-MMM-YYYY') ) as Date,

Month(Date#(Date, 'DD-MMM-YYYY') ) as Month,

Year(Date#(Date, 'DD-MMM-YYYY') ) as Year,

Day(Date#(Date, 'DD-MMM-YYYY') ) as Day,

'Q' & Ceil(Month(Date#(Date, 'DD-MMM-YYYY') ) /3) as Quarter

its_anandrjs

Day(Yourdatefield) as Day

Month(Yourdatefield) as Month

Year(Yourdatefield) as Year

'Q' & Ceil(Month(Yourdatefield) ) /3)

Hope this helps

dmohanty
Partner - Specialist
Partner - Specialist
Author

Thank you Manish and Anand for the quick help!!

its_anandrjs

Or another way also

Year(Date#('24-Oct-2013','DD-MMM-YYYY'))

Month(Date#('24-Oct-2013','DD-MMM-YYYY'))

Day(Date#('24-Oct-2013','DD-MMM-YYYY'))

'Q' & Ceil(Month(Date#('24-Oct-2013','DD-MMM-YYYY'))/3)

Hope this helps