By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,713 Members | 764 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,713 IT Pros & Developers. It's quick & easy.

Re: time module methods give an am or pm value ?

P: n/a
dj
Hello again,

Does anyone know which method in the time module will generate and am
or pm ?
If none of the method will do this for me. Can I produce the value on
my own ?
Any suggestions ?
Jun 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"dj" <d.***********@gmail.comwrote in message
news:23**********************************@l42g2000 hsc.googlegroups.com...
Hello again,

Does anyone know which method in the time module will generate and am
or pm ?
If none of the method will do this for me. Can I produce the value on
my own ?
Any suggestions ?
>>from time import *
strftime('%I:%M:%S %p',localtime(time()))
'07:23:24 AM'
>>strftime('%I:%M:%S %p',gmtime(time()))
'02:23:39 PM'

-Mark

Jun 27 '08 #2

P: n/a
dj wrote:
Hello again,

Does anyone know which method in the time module will generate and am
or pm ?
If none of the method will do this for me. Can I produce the value on
my own ?
Any suggestions ?
Read up about strftime (a function, not a method).

Generally, if you know you'll be using something for more than a few
uses, it is worth reading the entire documentation for that module.
People put a fair amount of effort into documentation, and they do it
to reduce the number of questions they have to answer one user at a
time. Reading the results of that effort before asking shows courtesy.
Few people mind explaining unclear documentation when the confusing part
is identified (and they know the answer). Similarly, asking (5000?, a
million?) to each spend a second so you can save an hour is bad economics.

--Scott David Daniels
Sc***********@Acm.Org
Jun 27 '08 #3

P: n/a
dj
On Jun 7, 9:24 am, "Mark Tolonen" <M8R-yft...@mailinator.comwrote:
"dj" <d.a.aberna...@gmail.comwrote in message

news:23**********************************@l42g2000 hsc.googlegroups.com...
Hello again,
Does anyone know which method in the time module will generate and am
or pm ?
If none of the method will do this for me. Can I produce the value on
my own ?
Any suggestions ?
>from time import *
strftime('%I:%M:%S %p',localtime(time()))
'07:23:24 AM'
>strftime('%I:%M:%S %p',gmtime(time()))

'02:23:39 PM'

-Mark
Hello Mark,

Thank you very much. I finally found this function in the
documentation.
Jun 27 '08 #4

P: n/a
dj
On Jun 7, 9:40 am, Scott David Daniels <Scott.Dani...@Acm.Orgwrote:
dj wrote:
Hello again,
Does anyone know which method in the time module will generate and am
or pm ?
If none of the method will do this for me. Can I produce the value on
my own ?
Any suggestions ?

Read up about strftime (a function, not a method).

Generally, if you know you'll be using something for more than a few
uses, it is worth reading the entire documentation for that module.
People put a fair amount of effort into documentation, and they do it
to reduce the number of questions they have to answer one user at a
time. Reading the results of that effort before asking shows courtesy.
Few people mind explaining unclear documentation when the confusing part
is identified (and they know the answer). Similarly, asking (5000?, a
million?) to each spend a second so you can save an hour is bad economics.

--Scott David Daniels
Scott.Dani...@Acm.Org
Hello Scott,

Thank you very much. I did find this function after shortly after I
posted this question.
I appreciated your help :-). And you are right, I do need to be a
better job of checking
the documentation, before I post. Thank you again for your help.
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.