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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
Partner - Creator
Partner - Creator

from extended month name to month number

hi, I have these fields:

 

day_number 

month_name_text ----> text format, extended names of months (january, february....)

year_number

 

how can I create a date in the YYYY-MM-DD format? (2023-07-17)

and how can I create a date in a format like 2023-jul-17 ?

 

Many thans

Labels (4)
3 Replies
Or
MVP
MVP

Date#(year_number & ' ' & month_name_text & ' ' & daynumber,'YYYY MMMM DD')  should convert the separate fields to a date. You can then format the date as desired using the date() function.

Note that the month names must exactly match the ones in your regional/variable settings for this to work correctly. If that's not the case, it's probably easiest to just write a Match() statement to convert the month names to numbers and then use MakeDate(Year,Match(Stuff here),Day).

 

ValeriaBonini
Partner - Creator
Partner - Creator
Author

ValeriaBonini_0-1689593235591.png

 

thank you, it works, but now I don't know why only May is like this

 

Or
MVP
MVP

(Date#('2020 March 01', 'YYYY MMMM DD') works for me. Perhaps your month names do not match (are they in a different language, maybe)?

It'd probably be easier to just write a Match statement than to fumble around with this. Match(Field,'January','February',etc) will return the corresponding month name.