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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
techvarun
Specialist II
Specialist II

Datetime Format Convertion

Hi Qlixperts

            I have three kind of date formats in a same aplication and the data sources are different

1. 201513  --- means 13th Week of 2015

2.2015-03-2015

3. 03/30/2015

I need to convert all these dates into a single format (Format number 3 03/30/2015)

can anyone help meout to change the format

in the format 1 (201513) basically i need to show the Monday's date of 13th month of the year

Thanks

Varun

5 Replies
Michiel_QV_Fan
Specialist
Specialist

Wel you need date#() function to set the format and then use Date() function to make them the same.

Also do you need to make use of makedate to add in the day numbers.

1. 201513  --- means 13th month of 2015


You need 4 weeks periods to get an 13th period in your year. A 13 month doesn't exist so cannot be created.


I this date a 13th period in the year?


2.2015-03-2015

date(makedate(date(date#(<your field>, 'YYYY-MM-YYYY'),'YYYY'), date(date#(<your field>, 'YYYY-MM-YYYY'),'MM'), monthend(date(date#(<your field>, 'YYYY-MM-YYYY'),'YYYY-MM'))), 'DD-MM-YYYY'') as Date


3. 03/30/2015

date(date#(<your field>, 'DD/MM/YYYY'), 'DD-MM-YYYY')

techvarun
Specialist II
Specialist II
Author

//1. 201513  --- means 13th month of 2015//

'


Mybad it is 13th week of 2015



Thanks

Varun

Colin-Albert
Partner - Champion
Partner - Champion

There aren't 13 months in a year, so the standard date format functions  date#() or makedate() will not work.

You will need to provide your own table that maps the year/period to a date.

You can use alt(expr1, expr2, exprN) to nest multiple expressions together, alt() will use the result from the first expression that returns a valid numeric value. As QlikView dates are dual values a correctly formatted date is seen as a number.

Michiel_QV_Fan
Specialist
Specialist

OK

DATE(date#(makeweekdate(left(<your field>, 4), right(<your field>, 2)), 'YYYYMDD'), 'DD-MM-YYYY')

techvarun
Specialist II
Specialist II
Author

Hello Albert

                      Thanks for your reply

                   It was a type (edited now)....

                   It is13th week of the year

Thanks

Varun