Hi Praveen,
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
pm suffix)
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.
Raúl
On Wed, Oct 26, 2011 at 10:46 AM, Praveen Singh <[email protected]>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...
>
>
>
>
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Raúl Cumplido
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor