Commit 70d292a8 authored by Michel Pelletier's avatar Michel Pelletier

Added patch from 'ejr' to support HTML4 W3C recommended format.

parent 20e9b34a
......@@ -84,7 +84,7 @@
##############################################################################
"""Encapsulation of date/time values"""
__version__='$Revision: 1.41 $'[11:-2]
__version__='$Revision: 1.42 $'[11:-2]
import sys, os, math, regex, ts_regex, DateTimeZone
......@@ -1285,6 +1285,21 @@ class DateTime:
self._year, self._month, self._day,
self._hour, self._minute, self._second)
def 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.
"""
newdate = self.toZone('UTC')
return "%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2dZ" % (
self._year, self._month, self._day,
self._hour, self._minute, self._second)
def __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."""
......
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