ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
Re: [Tutor] can time.time() be reversed so as to get date?
by Vince Spicer other posts by this author
Nov 6 2009 10:17AM messages near this date
[Tutor] can time.time() be reversed so as to get date? | Re: [Tutor] can time.time() be reversed so as to get date?
On Fri, Nov 6, 2009 at 10:30 AM, Shashwat Anand <anand.shashwat@[...].com> wrote:

>  If I have been given the number of seconds from midnight 1970.01.01 GMT,
>  can I calculate the date, month and time in the following format : 'Fri Nov
>  6 9:58:16 2009' ?
> 
>  _______________________________________________
>  Tutor maillist  -  Tutor@[...].org
>  To unsubscribe or change subscription options:
>  http://mail.python.org/mailman/listinfo/tutor
> 
> 

Sure,

   you can get datetime from a teimstamp

EX:


from datetime import datetime
import time

now = time.time()

date = datetime.fromtimestamp(now)

print date.strftime("%a %b %d %H:%M:%S %Y")



Vince
Thread:
Shashwat Anand
Vince Spicer
Alan Gauld
Alan Gauld
Alan Gauld
Timo
Shashwat Anand
Luke Paireepinart
Shashwat Anand
Dave Angel

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved