[Tutor] 12 hr to 24 hr time conversion
Alan Gauld
alan.gauld at btinternet.com
Wed Oct 26 11:28:31 CEST 2011
On 26/10/11 09:46, Praveen Singh wrote:
> How can i convert this-
>
> >>>time24hr('12:34am')
> '0034hr'
>
> i searched in date module but i am not able to figure out what how to do
> this...
In the time module you can use strptime to convert a string to a tuple.
And you can use strftime to convert a tuple to a string with user
specified formatting. I suspect one option will be 24 hour format.
So a combination of the two should achieve what you want...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list