Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharthsoam
Partner - Creator II
Partner - Creator II

Month name to number

Is their any function that converts month name to number for example when I pass 'Jan' it should return number 1

1 Solution

Accepted Solutions
prat1507
Specialist
Specialist

Use this

=If(num(month(date#(MyMonthName,'MMM')))<4,num(month(date#(MyMonthName,'MMM')))+9,

num(month(date#(MyMonthName,'MMM')))-3)

Regards
pratyush

View solution in original post

6 Replies
micheledenardi
Specialist II
Specialist II

=num(month(date#(MyMonthName,'MMM')))

how convert text (January) to month (1)

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
siddharthsoam
Partner - Creator II
Partner - Creator II
Author

Hi Michele,

Thanks for your answere its working , can you suggest me something if I want April month to have 1 number.

kuczynska
Creator III
Creator III

You can always try to change variable FirstMonthOfYear from MAIN tab of your load script:

SET FirstMonthOfYear=1;

to point to Apr:

SET FirstMonthOfYear=4;


But you need to remember that this will make a global change for the entire app and your first month of the year will be April.

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

Hi ,

I changed firstmonthofyear to 4 but still not able to get 1 corresponding to Apr using the above expression.

prat1507
Specialist
Specialist

Use this

=If(num(month(date#(MyMonthName,'MMM')))<4,num(month(date#(MyMonthName,'MMM')))+9,

num(month(date#(MyMonthName,'MMM')))-3)

Regards
pratyush

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

Can you tell me vice versa as well i.e. fetching month name from month number