469,923 Members | 1,350 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

date to digit

Is there a program in python that inputs a date & a
time, for example: 2005-04-17 04:20+0000. And
returns a digit, for example: 3501 instead?

and if there is such program or built-in function, how
can I run it inside a code?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 19 '05 #1
2 1130
try time.strptime() , and then time.time() - see documentation
(http://docs.python.org/lib/module-time.html)

Jul 19 '05 #2

"Sara Khalatbari" <sa************@yahoo.com> ha scritto nel messaggio
news:ma*************************************@pytho n.org...
Is there a program in python that inputs a date & a
time, for example: "2005-04-17 04:20+0000". And
returns a digit, for example: "3501" instead?

and if there is such program or built-in function, how
can I run it inside a code?
Here you go:
a = time.strptime("2005-04-17 04:20", "%Y-%m-%d %H:%M")
time.mktime(a)

1113704400.0

F.P.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

30 posts views Thread by Dr John Stockton | last post: by
4 posts views Thread by Tony | last post: by
1 post views Thread by Ian | last post: by
8 posts views Thread by John Wildes | last post: by
29 posts views Thread by james | last post: by
reply views Thread by jmarr02s | last post: by
3 posts views Thread by Jef Driesen | last post: by
vavc1980
1 post views Thread by vavc1980 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.