Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

Convert text month MMM into MM

i have a month which are text

Jan

Feb

Mar

Oct

Need to convert in to months MM in date format

8 Replies
sunny_talwar

Try this in the script:

Month(Date#(MonthField, 'MMM')) as MonthField

Where Month is dual and will be both Text and Number.

saumyashah90
Specialist
Specialist
Author

i want in MM not in MMM

which is not happening...

sunny_talwar

Try this:

Num(Month(Date#(MonthField, 'MMM'))) as MonthField

sunny_talwar

You can also try this:

Match(MonthField, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') as MonthField

Anonymous
Not applicable

you have month column separately I will suggest use Mapping load

and then  use ApplyMap() function to  replace Jan with 01,

Thanks

BKC

jagan
Luminary Alumni
Luminary Alumni

Hi Saumya,


Try like this

LOAd

*,

Date(Date#(MonthField, 'MMM'), 'MM') as MonthField

FROM DataSource;

OR

LOAd

*,

Match(MonthField, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') as MonthField

FROM DataSource;

OR

by using Mapping table.

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable

Try Some thing like this,

Month(Date(Date#(Field name,'MMM'),'MM')) as Temp

JohanLind1979
Contributor III
Contributor III

I just had the same problem. num(MonthField,'00') solves the problem within QlikView/Qlik Sense but the problem is that when I export to excel, the entry in the cell is '0' even though it displays '00'. I added the Text() function and that worked. Now it is ok in Qlik Sense and also after excel export. Final syntax is text(num(MonthField,'00'))