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: 
jim_chan
Specialist
Specialist

how to convert Date format "January" to "01"

Hi guys,

I have a month column called " Monthname" , it has value as "January, Feb,March,April......".

I want to change the value to instead of January, how to convert it to "01" ?

rgds,

Jim

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Depends on your format - do you have "January", full month name or "Feb", 3 character name, or both?

For full name:

=Num(Month(Date#('February', 'MMMM')), '00')

For abbrev name

=Num(Month(Date#('Feb', 'MMM')), '00')


Replace the literal month names with the relevant field name, like:

=Num(Month(Date#([Month_Name], 'MMMM')), '00')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

10 Replies
Mark_Little
Luminary
Luminary

Hi,

Not sure if there is a function to do this, but you could achieve with an if statement.

Something like is If(Month='Janurary', 01 ....

Or create an in line table and use the apply map function to change it over.

Mark

jonathandienst
Partner - Champion III
Partner - Champion III

Depends on your format - do you have "January", full month name or "Feb", 3 character name, or both?

For full name:

=Num(Month(Date#('February', 'MMMM')), '00')

For abbrev name

=Num(Month(Date#('Feb', 'MMM')), '00')


Replace the literal month names with the relevant field name, like:

=Num(Month(Date#([Month_Name], 'MMMM')), '00')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jim_chan
Specialist
Specialist
Author

Hi Jonathan,

i have full month name - January.

Rgds,

Jim

tresesco
MVP
MVP

Assuming all the month values in full (February rather than 'Feb'), you can try like:

Num(Month(Date#(Monthname, 'MMMM'))) as MonthNum

jim_chan
Specialist
Specialist
Author

Hello Jonathan,

what is the 00 for?

Rgds,

Jim

jyothish8807
Master II
Master II

Hi Jim,

Try like this:

=Num(Month(Date#(Monthname, 'MMMM')), '00')


Regards

KC

Best Regards,
KC
jim_chan
Specialist
Specialist
Author

my bad.. my date value format is MMMM, example: January, February, March, April, May.......

jim_chan
Specialist
Specialist
Author

MonthName value, sorry.

jonathandienst
Partner - Champion III
Partner - Champion III

>>what is the 00 for?

So that you get '01', '02', ...., '12' as per your original request. Otherwise you will get '1', '2', ..., '12'

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein