Converting human readable date into integer values
- by kahrn
Hello all,
I am looking to do something really simple. Merely convert a string, such as 'december' into something I can use with MySQL (such as '12').
At the moment I use a dict,
month_map = {
'december': '12',
'november': '11',
'october': '10',
'september': '09',
'august': '08',
'july': '07',
'june': '06',
'may': '05',
'april': '04',
'march': '03',
'february': '02',
'january': '01'
}
and then month_map.get('december').
Does any function already exist within the standard python modules that can achieve this? Apologies if this has already been asked.. the questions I have found using search seem a little different.