Commit b8c350cc authored by Amos Latteier's avatar Amos Latteier

Fixed up DateTime API docs. Added permissions, and created a link to time.strftime.

parent dac03d4e
...@@ -87,22 +87,21 @@ ...@@ -87,22 +87,21 @@
class DateTime: class DateTime:
""" """
The DateTime object provides an interface for working with dates The DateTime object provides an interface for working with dates
and times in various formats. DateTime also provides methods for and times in various formats. DateTime also provides methods for
calendar operations, date and time arithmetic and formatting. calendar operations, date and time arithmetic and formatting.
DateTime objects represent instants in time and provide DateTime objects represent instants in time and provide
interfaces for controlling its representation without interfaces for controlling its representation without
affecting the absolute value of the object. affecting the absolute value of the object.
DateTime objects may be created from a wide variety of string DateTime objects may be created from a wide variety of string
or numeric data, or may be computed from other DateTime objects. or numeric data, or may be computed from other DateTime objects.
DateTimes support the ability to convert their representations DateTimes support the ability to convert their representations
to many major timezones, as well as the ability to create a to many major timezones, as well as the ability to create a
DateTime object in the context of a given timezone. DateTime object in the context of a given timezone.
DateTime objects provide partial numerical behavior: DateTime objects provide partial numerical behavior:
- Two date-time objects can be subtracted to obtain a time, - Two date-time objects can be subtracted to obtain a time,
in days between the two. in days between the two.
...@@ -282,104 +281,103 @@ class DateTime: ...@@ -282,104 +281,103 @@ class DateTime:
def timeTime(): def timeTime():
""" """
Return the date/time as a floating-point number in UTC, in the Return the date/time as a floating-point number in UTC, in the
format used by the python time module. Note that it is format used by the python time module. Note that it is
possible to create date/time values with DateTime that have no possible to create date/time values with DateTime that have no
meaningful value to the time module. meaningful value to the time module.
Permission -- Always available
""" """
def toZone(z): def toZone(z):
""" """
Return a DateTime with the value as the current object, Return a DateTime with the value as the current object,
represented in the indicated timezone. represented in the indicated timezone.
Permission -- Always available
""" """
def isFuture(): def isFuture():
""" """
Return true if this object represents a date/time later than Return true if this object represents a date/time later than
the time of the call the time of the call
Permission -- Always available
""" """
def isPast(): def isPast():
""" """
Return true if this object represents a date/time earlier than Return true if this object represents a date/time earlier than
the time of the call the time of the call
Permission -- Always available
""" """
def isCurrentYear(): def isCurrentYear():
""" """
Return true if this object represents a date/time that falls Return true if this object represents a date/time that falls
within the current year, in the context of this object\'s within the current year, in the context of this object\'s
timezone representation timezone representation
Permission -- Always available
""" """
def isCurrentMonth(): def isCurrentMonth():
""" """
Return true if this object represents a date/time that falls Return true if this object represents a date/time that falls
within the current month, in the context of this object\'s within the current month, in the context of this object\'s
timezone representation timezone representation
Permission -- Always available
""" """
def isCurrentDay(): def isCurrentDay():
""" """
Return true if this object represents a date/time that falls Return true if this object represents a date/time that falls
within the current day, in the context of this object\'s within the current day, in the context of this object\'s
timezone representation timezone representation
Permission -- Always available
""" """
def isCurrentHour(): def isCurrentHour():
""" """
Return true if this object represents a date/time that falls Return true if this object represents a date/time that falls
within the current hour, in the context of this object\'s within the current hour, in the context of this object\'s
timezone representation timezone representation
Permission -- Always available
""" """
def isCurrentMinute(): def isCurrentMinute():
""" """
Return true if this object represents a date/time that falls Return true if this object represents a date/time that falls
within the current minute, in the context of this object\'s within the current minute, in the context of this object\'s
timezone representation timezone representation
Permission -- Always available
""" """
def earliestTime(): def earliestTime():
""" """
Return a new DateTime object that represents the earliest Return a new DateTime object that represents the earliest
possible time (in whole seconds) that still falls within the possible time (in whole seconds) that still falls within the
current object\'s day, in the object\'s timezone context current object's day, in the object's timezone context
Permission -- Always available
""" """
def latestTime(): def latestTime():
""" """
Return a new DateTime object that represents the latest Return a new DateTime object that represents the latest
possible time (in whole seconds) that still falls within the possible time (in whole seconds) that still falls within the
current object\'s day, in the object\'s timezone context current object's day, in the object's timezone context
Permission -- Always available
""" """
def greaterThan(self,t): def greaterThan(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -387,11 +385,11 @@ class DateTime: ...@@ -387,11 +385,11 @@ class DateTime:
style time. Revised to give more correct results through style time. Revised to give more correct results through
comparison of long integer milliseconds. comparison of long integer milliseconds.
Permission -- Always available
""" """
def greaterThanEqualTo(self,t): def greaterThanEqualTo(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -399,11 +397,11 @@ class DateTime: ...@@ -399,11 +397,11 @@ class DateTime:
time module style time. Revised to give more correct results time module style time. Revised to give more correct results
through comparison of long integer milliseconds. through comparison of long integer milliseconds.
Permission -- Always available
""" """
def equalTo(self,t): def equalTo(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -411,11 +409,11 @@ class DateTime: ...@@ -411,11 +409,11 @@ class DateTime:
time. Revised to give more correct results through comparison time. Revised to give more correct results through comparison
of long integer milliseconds. of long integer milliseconds.
Permission -- Always available
""" """
def notEqualTo(self,t): def notEqualTo(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -423,11 +421,11 @@ class DateTime: ...@@ -423,11 +421,11 @@ class DateTime:
style time. Revised to give more correct results through style time. Revised to give more correct results through
comparison of long integer milliseconds. comparison of long integer milliseconds.
Permission -- Always available
""" """
def lessThan(self,t): def lessThan(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -435,11 +433,11 @@ class DateTime: ...@@ -435,11 +433,11 @@ class DateTime:
style time. Revised to give more correct results through style time. Revised to give more correct results through
comparison of long integer milliseconds. comparison of long integer milliseconds.
Permission -- Always available
""" """
def lessThanEqualTo(self,t): def lessThanEqualTo(self,t):
""" """
Compare this DateTime object to another DateTime object OR a Compare this DateTime object to another DateTime object OR a
floating point number such as that which is returned by the floating point number such as that which is returned by the
python time module. Returns true if the object represents a python time module. Returns true if the object represents a
...@@ -447,215 +445,210 @@ class DateTime: ...@@ -447,215 +445,210 @@ class DateTime:
module style time. Revised to give more correct results module style time. Revised to give more correct results
through comparison of long integer milliseconds. through comparison of long integer milliseconds.
Permission -- Always available
""" """
def isLeapYear(): def isLeapYear():
""" """
Return true if the current year (in the context of the Return true if the current year (in the context of the
object\'s timezone) is a leap year object's timezone) is a leap year
Permission -- Always available
""" """
def dayOfYear(): def dayOfYear():
""" """
Return the day of the year, in context of the timezone Return the day of the year, in context of the timezone
representation of the object representation of the object
Permission -- Always available
""" """
# Component access # Component access
def parts(): def parts():
""" """
Return a tuple containing the calendar year, month, day, hour, Return a tuple containing the calendar year, month, day, hour,
minute second and timezone of the object minute second and timezone of the object
Permission -- Always available
""" """
def timezone(): def timezone():
""" """
Return the timezone in which the object is represented. Return the timezone in which the object is represented.
Permission -- Always available
""" """
def year(): def year():
""" """
Return the calendar year of the object Return the calendar year of the object
Permission -- Always available
""" """
def month(): def month():
""" """
Return the month of the object as an integer Return the month of the object as an integer
Permission -- Always available
""" """
def Month(): def Month():
""" """
Return the full month name Return the full month name
Permission -- Always available
""" """
def aMonth(): def aMonth():
""" """
Return the abbreviated month name. Return the abbreviated month name.
Permission -- Always available
""" """
def Mon(): def Mon():
""" """
Compatibility: see aMonth Compatibility: see aMonth
Permission -- Always available
""" """
def pMonth(): def pMonth():
""" """
Return the abbreviated (with period) month name. Return the abbreviated (with period) month name.
Permission -- Always available
""" """
def Mon_(): def Mon_():
""" """
Compatibility: see pMonth Compatibility: see pMonth
Permission -- Always available
""" """
def day(): def day():
""" """
Return the integer day Return the integer day
Permission -- Always available
""" """
def Day(): def Day():
""" """
Return the full name of the day of the week Return the full name of the day of the week
Permission -- Always available
""" """
def DayOfWeek(): def DayOfWeek():
""" """
Compatibility: see Day Compatibility: see Day
Permission -- Always available
""" """
def aDay(): def aDay():
""" """
Return the abbreviated name of the day of the week Return the abbreviated name of the day of the week
Permission -- Always available
""" """
def pDay(): def pDay():
""" """
Return the abbreviated (with period) name of the day of the Return the abbreviated (with period) name of the day of the
week week
Permission -- Always available
""" """
def Day_(): def Day_():
""" """
Compatibility: see pDay Compatibility: see pDay
Permission -- Always available
""" """
def dow(): def dow():
""" """
Return the integer day of the week, where Sunday is 0 Return the integer day of the week, where Sunday is 0
Permission -- Always available
""" """
def dow_1(): def dow_1():
""" """
Return the integer day of the week, where Sunday is 1 Return the integer day of the week, where Sunday is 1
Permission -- Always available
""" """
def h_12(): def h_12():
""" """
Return the 12-hour clock representation of the hour Return the 12-hour clock representation of the hour
Permission -- Always available
""" """
def h_24(): def h_24():
""" """
Return the 24-hour clock representation of the hour Return the 24-hour clock representation of the hour
Permission -- Always available
""" """
def ampm(): def ampm():
""" """
Return the appropriate time modifier (am or pm) Return the appropriate time modifier (am or pm)
Permission -- Always available
""" """
def hour(): def hour():
""" """
Return the 24-hour clock representation of the hour Return the 24-hour clock representation of the hour
Permission -- Always available
""" """
def minute(): def minute():
""" """
Return the minute Return the minute
Permission -- Always available
""" """
def second(): def second():
""" """
Return the second Return the second
Permission -- Always available
""" """
def millis(): def millis():
""" """
Return the millisecond since the epoch in GMT. Return the millisecond since the epoch in GMT.
Permission -- Always available
""" """
def strftime(format): def strftime(format):
...@@ -663,107 +656,161 @@ class DateTime: ...@@ -663,107 +656,161 @@ class DateTime:
Return date time string formatted according to 'format' Return date time string formatted according to 'format'
See Python's
"time.strftime":http://www.python.org/doc/current/lib/module-time.html
function.
""" """
# General formats from previous DateTime # General formats from previous DateTime
def Date(): def Date():
""" """
Return the date string for the object. Return the date string for the object.
Permission -- Always available
""" """
def Time(): def Time():
""" """
Return the time string for an object to the nearest second. Return the time string for an object to the nearest second.
Permission -- Always available
""" """
def TimeMinutes(): def TimeMinutes():
""" """
Return the time string for an object not showing seconds. Return the time string for an object not showing seconds.
Permission -- Always available
""" """
def AMPM(): def AMPM():
""" """
Return the time string for an object to the nearest second. Return the time string for an object to the nearest second.
Permission -- Always available
""" """
def AMPMMinutes(): def AMPMMinutes():
""" """
Return the time string for an object not showing seconds. Return the time string for an object not showing seconds.
Permission -- Always available
""" """
def PreciseTime(): def PreciseTime():
""" """
Return the time string for the object. Return the time string for the object.
Permission -- Always available
""" """
def PreciseAMPM(): def PreciseAMPM():
"""Return the time string for the object.""" """
Return the time string for the object.
Permission -- Always available
"""
def yy(): def yy():
"""Return calendar year as a 2 digit string""" """
Return calendar year as a 2 digit string
Permission -- Always available
"""
def mm(): def mm():
"""Return month as a 2 digit string""" """
Return month as a 2 digit string
Permission -- Always available
"""
def dd(): def dd():
"""Return day as a 2 digit string""" """
Return day as a 2 digit string
Permission -- Always available
"""
def rfc822(): def rfc822():
"""Return the date in RFC 822 format""" """
Return the date in RFC 822 format
Permission -- Always available
"""
# New formats # New formats
def fCommon(): def fCommon():
"""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
Permission -- Always available
"""
def fCommonZ(): def fCommonZ():
"""Return a string representing the object\'s value """
in the format: March 1, 1997 1:45 pm US/Eastern""" Return a string representing the object's value
in the format: March 1, 1997 1:45 pm US/Eastern
Permission -- Always available
"""
def aCommon(): def aCommon():
"""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
Permission -- Always available
"""
def aCommonZ(): def aCommonZ():
"""Return a string representing the object\'s value """
in the format: Mar 1, 1997 1:45 pm US/Eastern""" Return a string representing the object's value
in the format: Mar 1, 1997 1:45 pm US/Eastern
Permission -- Always available
"""
def pCommon(): def pCommon():
"""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
Permission -- Always available
"""
def pCommonZ(): def pCommonZ():
"""Return a string representing the object\'s value """
in the format: Mar. 1, 1997 1:45 pm US/Eastern""" Return a string representing the object's value
in the format: Mar. 1, 1997 1:45 pm US/Eastern
Permission -- Always available
"""
def ISO(): def ISO():
"""Return the object in ISO standard format """
Return the object in ISO standard format
Dates are output as: YYYY-MM-DD HH:MM:SS Dates are output as: YYYY-MM-DD HH:MM:SS
Permission -- Always available
""" """
def HTML4(): def HTML4():
"""Return the object in the format used in the HTML4.0 specification, """
one of the standard forms in ISO8601. See Return the object in the format used in the HTML4.0 specification,
http://www.w3.org/TR/NOTE-datetime one of the standard forms in ISO8601.
See "HTML 4.0 Specification":http://www.w3.org/TR/NOTE-datetime
Dates are output as: YYYY-MM-DDTHH:MM:SSZ Dates are output as: YYYY-MM-DDTHH:MM:SSZ
T, Z are literal characters. T, Z are literal characters.
The time is in UTC. The time is in UTC.
Permission -- Always available
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment