Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Some Class Definitions

A time.struct_time object behaves like an object as well as a tuple. You can access the attributes of the structure by position as well as by name. Note that this class has no methods of it's own; you manipulate these objects using functions in the time module.

tm_year

The year. This will be a full four digit year, e.g. 1998.

tm_mon

The month. This will be in the range of 1 to 12.

tm_mday

The day of the month. This will be in the range of 1 to the number of days in the given month.

tm_hour

The hour of the day, in the range 0 to 23.

tm_min

The minutes of the hour, in the range 0 to 59.

tm_sec

The seconds of the minute, in the range 0 to 61 because leap seconds may be included. Not all platforms support leap seconds.

tm_wday

The day of the week. This will be in the range of 0 to 6. 0 is Monday, 6 is Sunday.

tm_yday

The day of the year, in the range 1 to 366.

tm_isdst

Is the time in local daylight savings time. 0 means that this is standard time; 1 means daylight time. If you are creating this object, you can provide -1; the mktime can then determine DST based on the date and time.

We'll focus on the datetime.datetime class, since it includes datetime.date and datetime.time. This class has the following attributes.

MINYEAR, MAXYEAR

These two attributes bracket the time span for which datetime works correctly. This is year 1 to year 9999, which covers the forseeable future as well as a past the predates the invention of the Gregorian calendar in 1582.

min, max

The earliest and laterst representable datetimes. In effect these are datetime(MINYEAR, 1, 1, tzinfo=None) and (MAXYEAR, 12, 31, 23, 59, 59, 999999, tzinfo=None).

resolution

The smallest differences between datetimes. This is typically equaly to timedelta(microseconds=1).

year

The year. This will be a full four digit year, e.g. 1998. It will always be between MINYEAR and MAXYEAR, inclusive.

month

The month. This will be in the range 1 to 12.

day

The day. This will be in the range 1 to the number of days in the given month.

hour

The hour. This will be in the range 0 to 23.

minute

The minute. This will be in the range 0 to 59.

second

The second. This will be in the range 0 to 59.

microsecond

The microsecond (millionths of a second). This will in the range 0 to 999,999. Some platforms don't have a system clock which is this accurate. However, the SQL standard imposes this resolution on most date time values.

tzinfo

The datetime.tzinfo object that was provided to the initial datetime.datetime constructor. Otherwise it will be None.


 
 
  Published under the terms of the Open Publication License Design by Interspire