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

Month Name to Month Number in Qlikview

Hi...

I have the month in the format "Mon" ie August is represented as "Aug". I need to convert the month name to Month Number. The Month function requires a date stamp and I am not able to use the makedate function as it requires month as integer. Can someone help me with getting the month number based on month date?

Thank you.

Regards

Kumar

20 Replies
Not applicable
Author

The easiest way will be to just num the date.

Dates are duel functions. Thus you will be able to num('May') and get 5

matthewjbryant
Creator II
Creator II

Yep. This's the solution for me!

Not applicable
Author

Exactly what I was looking for!

Not applicable
Author

Thanks John ... i was looking for this kind of solution

Not applicable
Author

This worked perfectly: num(month(SOMEDATE),'00')

Thank you.

Anonymous
Not applicable
Author

This solution helped me today...many Thanks!

Not applicable
Author

I was looking for this.... Got it.

dirk1955
Creator
Creator

Hi guys,

Isn't it much simpler to temporary change the variable "MontNames".

I work like this.

My normal monthnames format:

SET MonthNames='jan;feb;mrt;apr;mei;jun;jul;aug;sep;okt;nov;dec';

Just before the load-script where i need the months shown as numbers i change the var monthnames to:

SET MonthNames='01;02;03;04;05;06;07;08;09;10;11;12';

After the load-script i change it back to its original format.

SET MonthNames='jan;feb;mrt;apr;mei;jun;jul;aug;sep;okt;nov;dec';


Greets

Dirk

ankitbisht01
Creator
Creator

Thank you very nice  solution

psankepalli
Partner - Creator III
Partner - Creator III

Hi,

Please find the attached QVW, which converts the date to your required format.

First I created variable

vDate =Date#(TextBetween(InputDate, ' ', 'th') & '-' & SubField(InputDate, ' ', 3) & '-' & SubField(InputDate, ' ', 4), 'dd-MMMM-yyyy')

then re-used that variable into text box

=Date(vDate,'DD-MM-YYYY')

hope this will solve your problem

Thanks

PR