Understanding DateTime, tzinfo, timedelta & TimeZone Conversions in python

By : rama

python-logo 3289799486_fd7df39a73

In this post we will look at the common operations that are being performed on dates & time ,  converting  a datetime from one timzone to another timezone.

Common Operations:             How to get the present datetime?

In [189]: cdatetime = datetime.now()
In [190]: cdatetime
Out[190]: datetime.datetime(2009, 2, 17, 17, 34, 58, 407806)
It returns the current localdate and time.When i print cdatetime it  printed as a tuple of nine elements
(2009=year, 2=month, 17=day, 17=hour, 34=minutes, 58=seconds, 407806=microseconds, tzinfo is None and is not printed)
what each element in tuple represents ...

more info..
Topics : datetime
© Agiliq, 2009-2012