Trees | Index | Help |
|
---|
Package DateTime :: Module DateTime :: Class DateTime |
|
DateTime objects represent instants in time and provide interfaces for controlling its representation without affecting the absolute value of the object. DateTime objects may be created from a wide variety of string or numeric data, or may be computed from other DateTime objects. DateTimes support the ability to convert their representations to many major timezones, as well as the ablility to create a DateTime object in the context of a given timezone. DateTime objects provide partial numerical behavior: - Two date-time objects can be subtracted to obtain a time, in days between the two. - A date-time object and a positive or negative number may be added to obtain a new date-time object that is the given number of days later than the input date-time object. - A positive or negative number and a date-time object may be added to obtain a new date-time object that is the given number of days later than the input date-time object. - A positive or negative number may be subtracted from a date-time object to obtain a new date-time object that is the given number of days earlier than the input date-time object. DateTime objects may be converted to integer, long, or float numbers of days since January 1, 1901, using the standard int, long, and float functions (Compatibility Note: int, long and float return the number of days since 1901 in GMT rather than local machine timezone). DateTime objects also provide access to their value in a float format usable with the python time module, provided that the value of the object falls in the range of the epoch-based time module. A DateTime object should be considered immutable; all conversion and numeric operations return a new DateTime object rather than modify the current object.
Method Summary | |
---|---|
Return a new date-time object | |
A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added. | |
Compare a DateTime with another DateTime object, or a float such as those returned by time.time(). | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Convert to floating-point number of seconds since the epoch (gmt) | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
__getattr__(self,
name)
| |
__getinitargs__(self)
| |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Compute a hash value for a DateTime | |
Convert to an integer number of seconds since the epoch (gmt) | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Convert to a long-int number of seconds since the epoch (gmt) | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added. | |
Convert a DateTime to a string that looks like a Python expression. | |
Convert a DateTime to a string. | |
Either a DateTime or a number may be subtracted from a DateTime, however, a DateTime may not be subtracted from a number. | |
Return a string representing the object's value in the format: Mar 1, 1997 1:45 pm | |
Return a string representing the object's value in the format: Mar 1, 1997 1:45 pm US/Eastern | |
Return the abreviated name of the day of the week | |
Return the abreviated month name. | |
Return the time string for an object to the nearest second. | |
Return the appropriate time modifier (am or pm) | |
Return the time string for an object not showing seconds. | |
Return the date string for the object. | |
Return the full name of the day of the week | |
Return the integer day | |
Compatibility: see pDay | |
Compatibility: see Day | |
Return the day of the year, in context of the timezone representation of the object | |
Return day as a 2 digit string | |
Return the integer day of the week, where sunday is 0 | |
Return the integer day of the week, where sunday is 1 | |
Return a new DateTime object that represents the earliest possible time (in whole seconds) that still falls within the current object's day, in the object's timezone context | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Return a string representing the object's value in the format: March 1, 1997 1:45 pm | |
Return a string representing the object's value in the format: March 1, 1997 1:45 pm US/Eastern | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Return the 12-hour clock representation of the hour | |
Return the 24-hour clock representation of the hour | |
Return the 24-hour clock representation of the hour | |
Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. | |
Return true if this object represents a date/time that falls within the current day, in the context of this object's timezone representation | |
Return true if this object represents a date/time that falls within the current hour, in the context of this object's timezone representation | |
Return true if this object represents a date/time that falls within the current minute, in the context of this object's timezone representation | |
Return true if this object represents a date/time that falls within the current month, in the context of this object's timezone representation | |
Return true if this object represents a date/time that falls within the current year, in the context of this object's timezone representation | |
Return true if this object represents a date/time later than the time of the call | |
Return true if the current year (in the context of the object's timezone) is a leap year | |
Return the object in ISO standard format. | |
Return the object in ISO 8601-compatible format containing the date, time with seconds-precision and the time zone identifier - see http://www.w3.org/TR/NOTE-datetime Dates are output as: YYYY-MM-DDTHH:MM:SSTZD T is a literal character. | |
Return true if this object represents a date/time earlier than the time of the call | |
Return the Julian day according to http://www.tondering.dk/claus/cal/node3.html#sec-calcjd | |
Return a new DateTime object that represents the latest possible time (in whole seconds) that still falls within the current object's day, in the object's timezone context | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Returns the time zone on the given date. | |
Return the millisecond since the epoch in GMT. | |
Return the minute | |
Return month as a 2 digit string | |
Compatibility: see aMonth | |
Compatibility: see pMonth | |
Return the full month name | |
Return the month of the object as an integer | |
Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. | |
Return a tuple containing the calendar year, month, day, hour, minute second and timezone of the object | |
Return a string representing the object's value in the format: Mar. | |
Return a string representing the object's value in the format: Mar. | |
Return the abreviated (with period) name of the day of the week | |
Return the abreviated (with period) month name. | |
Return the time string for the object. | |
Return the time string for the object. | |
Return the date in RFC 822 format | |
Return the second | |
strftime(self,
format)
| |
Return the time string for an object to the nearest second. | |
Return the time string for an object not showing seconds. | |
Return the date/time as a floating-point number in UTC, in the format used by the python time module. | |
Return the timezone in which the object is represented. | |
Return a DateTime with the value as the current object, represented in the indicated timezone. | |
Return the timezone offset for the objects timezone. | |
Return the week number according to ISO see http://www.tondering.dk/claus/cal/node6.html#SECTION00670000000000000000 | |
Return the calendar year of the object | |
Return calendar year as a 2 digit string |
Class Variable Summary | |
---|---|
int |
__allow_access_to_unprotected_subobjects__ = 1 |
NoneType |
__roles__ = None |
classobj |
DateError = DateTime.DateTime.DateError |
classobj |
DateTimeError = DateTime.DateTime.DateTimeError |
str |
delimiters = '-/.:,+'
|
SRE_Pattern |
flt_pattern = :([0-9]+\.[0-9]+)
|
SRE_Pattern |
int_pattern = ([0-9]+)
|
SRE_Pattern |
name_pattern = ([a-zA-Z]+)
|
str |
space_chars = ' \t\n'
|
classobj |
SyntaxError = DateTime.DateTime.SyntaxError |
classobj |
TimeError = DateTime.DateTime.TimeError |
Method Details |
---|
__init__(self,
*args,
**kw)
Return a new date-time object
|
__add__(self,
other)
A DateTime may be added to a number and a number may be added to a
DateTime; two DateTimes cannot be added.
|
__cmp__(self,
obj)
|
__eq__(self,
t)
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the python time
module. Returns true if the object represents a date/time equal to the
specified DateTime or time module style time. Revised to give more
correct results through comparison of long integer milliseconds.
|
__float__(self)Convert to floating-point number of seconds since the epoch (gmt) |
__ge__(self,
t)
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the python time
module. Returns true if the object represents a date/time greater than
or equal to the specified DateTime or time module style time. Revised
to give more correct results through comparison of long integer
milliseconds.
|
__gt__(self,
t)
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the python time
module. Returns true if the object represents a date/time greater than
the specified DateTime or time module style time. Revised to give more
correct results through comparison of long integer milliseconds.
|
__hash__(self)
Compute a hash value for a DateTime
|
__int__(self)Convert to an integer number of seconds since the epoch (gmt) |
__le__(self,
t)
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the python time
module. Returns true if the object represents a date/time less than or
equal to the specified DateTime or time module style time. Revised to
give more correct results through comparison of long integer
milliseconds.
|
__long__(self)Convert to a long-int number of seconds since the epoch (gmt) |
__lt__(self,
t)
Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the python time
module. Returns true if the object represents a date/time less than the
specified DateTime or time module style time. Revised to give more
correct results through comparison of long integer milliseconds.
|
__ne__(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time not equal to the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
__radd__(self,
other)
A DateTime may be added to a number and a number may be added to a
DateTime; two DateTimes cannot be added.
|
__repr__(self)
Convert a DateTime to a string that looks like a Python
expression.
|
__str__(self)
Convert a DateTime to a string.
|
__sub__(self,
other)
Either a DateTime or a number may be subtracted from a DateTime,
however, a DateTime may not be subtracted from a number.
|
aCommon(self)Return a string representing the object's value in the format: Mar 1, 1997 1:45 pm |
aCommonZ(self)Return a string representing the object's value in the format: Mar 1, 1997 1:45 pm US/Eastern |
aDay(self)Return the abreviated name of the day of the week |
aMonth(self)Return the abreviated month name. |
AMPM(self)Return the time string for an object to the nearest second. |
ampm(self)Return the appropriate time modifier (am or pm) |
AMPMMinutes(self)Return the time string for an object not showing seconds. |
Date(self)Return the date string for the object. |
Day(self)Return the full name of the day of the week |
day(self)Return the integer day |
Day_(self)Compatibility: see pDay |
DayOfWeek(self)Compatibility: see Day |
dayOfYear(self)Return the day of the year, in context of the timezone representation of the object |
dd(self)Return day as a 2 digit string |
dow(self)Return the integer day of the week, where sunday is 0 |
dow_1(self)Return the integer day of the week, where sunday is 1 |
earliestTime(self)Return a new DateTime object that represents the earliest possible time (in whole seconds) that still falls within the current object's day, in the object's timezone context |
equalTo(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time equal to the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
fCommon(self)Return a string representing the object's value in the format: March 1, 1997 1:45 pm |
fCommonZ(self)Return a string representing the object's value in the format: March 1, 1997 1:45 pm US/Eastern |
greaterThan(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
greaterThanEqualTo(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than or equal to the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
h_12(self)Return the 12-hour clock representation of the hour |
h_24(self)Return the 24-hour clock representation of the hour |
hour(self)Return the 24-hour clock representation of the hour |
HTML4(self)Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime Dates are output as: YYYY-MM-DDTHH:MM:SSZ T, Z are literal characters. The time is in UTC. |
isCurrentDay(self)Return true if this object represents a date/time that falls within the current day, in the context of this object's timezone representation |
isCurrentHour(self)Return true if this object represents a date/time that falls within the current hour, in the context of this object's timezone representation |
isCurrentMinute(self)Return true if this object represents a date/time that falls within the current minute, in the context of this object's timezone representation |
isCurrentMonth(self)Return true if this object represents a date/time that falls within the current month, in the context of this object's timezone representation |
isCurrentYear(self)Return true if this object represents a date/time that falls within the current year, in the context of this object's timezone representation |
isFuture(self)Return true if this object represents a date/time later than the time of the call |
isLeapYear(self)Return true if the current year (in the context of the object's timezone) is a leap year |
ISO(self)Return the object in ISO standard format. Note: this is *not* ISO 8601-format! See the ISO8601 and HTML4 methods below for ISO 8601-compliant output Dates are output as: YYYY-MM-DD HH:MM:SS |
ISO8601(self)Return the object in ISO 8601-compatible format containing the date, time with seconds-precision and the time zone identifier - see http://www.w3.org/TR/NOTE-datetime Dates are output as: YYYY-MM-DDTHH:MM:SSTZD T is a literal character. TZD is Time Zone Designator, format +HH:MM or -HH:MM The HTML4 method below offers the same formatting, but converts to UTC before returning the value and sets the TZD "Z" |
isPast(self)Return true if this object represents a date/time earlier than the time of the call |
JulianDay(self)Return the Julian day according to http://www.tondering.dk/claus/cal/node3.html#sec-calcjd |
latestTime(self)Return a new DateTime object that represents the latest possible time (in whole seconds) that still falls within the current object's day, in the object's timezone context |
lessThan(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
lessThanEqualTo(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than or equal to the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
localZone(self, ltm=None)Returns the time zone on the given date. The time zone can change according to daylight savings. |
millis(self)Return the millisecond since the epoch in GMT. |
minute(self)Return the minute |
mm(self)Return month as a 2 digit string |
Mon(self)Compatibility: see aMonth |
Mon_(self)Compatibility: see pMonth |
Month(self)Return the full month name |
month(self)Return the month of the object as an integer |
notEqualTo(self, t)Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time not equal to the specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. |
parts(self)Return a tuple containing the calendar year, month, day, hour, minute second and timezone of the object |
pCommon(self)Return a string representing the object's value in the format: Mar. 1, 1997 1:45 pm |
pCommonZ(self)Return a string representing the object's value in the format: Mar. 1, 1997 1:45 pm US/Eastern |
pDay(self)Return the abreviated (with period) name of the day of the week |
pMonth(self)Return the abreviated (with period) month name. |
PreciseAMPM(self)Return the time string for the object. |
PreciseTime(self)Return the time string for the object. |
rfc822(self)Return the date in RFC 822 format |
second(self)Return the second |
Time(self)Return the time string for an object to the nearest second. |
TimeMinutes(self)Return the time string for an object not showing seconds. |
timeTime(self)Return the date/time as a floating-point number in UTC, in the format used by the python time module. Note that it is possible to create date/time values with DateTime that have no meaningful value to the time module. |
timezone(self)Return the timezone in which the object is represented. |
toZone(self, z)Return a DateTime with the value as the current object, represented in the indicated timezone. |
tzoffset(self)Return the timezone offset for the objects timezone. |
week(self)Return the week number according to ISO see http://www.tondering.dk/claus/cal/node6.html#SECTION00670000000000000000 |
year(self)Return the calendar year of the object |
yy(self)Return calendar year as a 2 digit string |
Class Variable Details |
---|
__allow_access_to_unprotected_subobjects__
|
__roles__
|
delimiters
|
flt_pattern
|
int_pattern
|
name_pattern
|
space_chars
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Thu Aug 16 09:55:07 2007 | http://epydoc.sf.net |