Commit ba0815f1 authored by 's avatar

Merged Steve Alexander's better strftime patch from 2.2 branch

parent 548eb048
......@@ -84,7 +84,7 @@
##############################################################################
"""Encapsulation of date/time values"""
__version__='$Revision: 1.53 $'[11:-2]
__version__='$Revision: 1.54 $'[11:-2]
import sys, os, math, regex, ts_regex, DateTimeZone
......@@ -1377,15 +1377,14 @@ class DateTime:
def strftime(self, format):
# Format the date/time using the *current timezone representation*.
jfirst = _julianday(self._year, 1, 1) - 1
jtoday = _julianday(self._year, self._month, self._day)
julian = jtoday - jfirst
time_info=(self._year, self._month, self._day,
self._hour, self._minute, self._nearsec,
(self._dayoffset + 6) % 7,
julian,
0)
return strftime(format, time_info)
diff = _tzoffset(self._tz, self._t)
format = ts_regex.gsub('\(^\|[^%]\)%Z',
'\\1' + self._tz,
format)
format = ts_regex.gsub('\(^\|[^%]\)%z',
'\\1%+05d' % (diff / 36),
format)
return strftime(format, gmtime(self.timeTime() + diff))
# General formats from previous DateTime
def Date(self):
......
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