Vizible’s Blog

Python – Datetime example

Posted in Python by wearetherock on July 11, 2009

>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2009, 7, 11, 22, 39, 25, 624000)

>>> str(datetime.datetime.now())
‘2009-07-11 22:40:05.685000’

>>> str(datetime.datetime.now())[-6:]
‘848000’

>>> str(datetime.datetime.now())[:19]
‘2009-07-11 22:42:40’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: