[Tutor] 12 hr to 24 hr time conversion
raulcumplido at gmail.com
Wed Oct 26 11:21:31 CEST 2011
Do you want to create the functon time24hr which with a string as an
argument of the type ("12:24am") or ("12:24pm") returns an output of
("0024hr") or ("1224hr"), right?
Is this format fixed? I mean, can you create a two arguments function? (i.e
time24hr("12:24", "AM") )
If you cannot change the format of the functions / arguments, I don't know
if there's any standard function to do that, but I will create a function
with this steps inside:
1.- Check the format of the input is ok (has the hour format and the am or
2.- Check if it's am or pm
3.- Calculate if I had to modify the hour 12 --> 00 , 11 --> 23 ....
3.- Return the output format.
On Wed, Oct 26, 2011 at 10:46 AM, Praveen Singh <c2praveen30jun at gmail.com>wrote:
> How can i convert this-
> i searched in date module but i am not able to figure out what how to do
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor