date to digit

Fabio Pliger fabio.pliger at siavr.it
Sat Apr 30 10:26:21 EDT 2005


"Sara Khalatbari" <sarapythonlist at yahoo.com> ha scritto nel messaggio
news:mailman.57.1114858019.14961.python-list at python.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







More information about the Python-list mailing list