[Zope-Checkins]
SVN: Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.
more stuff migrated, slightly adjusted doc tests
Andreas Jung
andreas at andreas-jung.com
Sun Aug 26 05:46:41 EDT 2007
Log message for revision 79280:
more stuff migrated, slightly adjusted doc tests
Changed:
U Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
U Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.txt
-=-
Modified: Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py 2007-08-26 09:28:35 UTC (rev 79279)
+++ Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py 2007-08-26 09:46:40 UTC (rev 79280)
@@ -1615,52 +1615,66 @@
zself._minute, int(zself._nearsec),
microseconds).strftime(format)
res = format_is_unicode and unicode(ds, 'utf-8') or ds
- print repr(res), repr(self._D.strftime(format))
+
+ res2 = self._D.strftime(format)
+# if res2 != res:
+# print 'Fehler:', repr(res), repr(self._D.strftime(format))
+
return res
# General formats from previous DateTime
def Date(self):
"""Return the date string for the object."""
- return "%s/%2.2d/%2.2d" % (self._year, self._month, self._day)
+ # MIGRATED
+ return self._D.strftime('%Y/%m/%d')
def Time(self):
"""Return the time string for an object to the nearest second."""
- return '%2.2d:%2.2d:%2.2d' % (self._hour,self._minute,self._nearsec)
+ # MIGRATED
+ return self._D.strftime('%H:%M:%S')
def TimeMinutes(self):
"""Return the time string for an object not showing seconds."""
- return '%2.2d:%2.2d' % (self._hour,self._minute)
+ # MIGRATED
+ return self._D.strftime('%H:%M')
def AMPM(self):
"""Return the time string for an object to the nearest second."""
- return '%2.2d:%2.2d:%2.2d %s' % (
- self._pmhour,self._minute,self._nearsec,self._pm)
+ # MIGRATED
+ return self._D.strftime('%I:%M:%S %p')
def AMPMMinutes(self):
"""Return the time string for an object not showing seconds."""
- return '%2.2d:%2.2d %s' % (self._pmhour,self._minute,self._pm)
+ return self._D.strftime('%I:%M %p')
def PreciseTime(self):
"""Return the time string for the object."""
- return '%2.2d:%2.2d:%06.3f' % (self._hour,self._minute,self._second)
+ # MIGRATED
+ secs = self._D.second + self._D.microsecond/1000000.0
+ return self._D.strftime('%H:%M:') + '%06.3f' % secs
def PreciseAMPM(self):
"""Return the time string for the object."""
- return '%2.2d:%2.2d:%06.3f %s' % (
- self._pmhour,self._minute,self._second,self._pm)
+ # MIGRATED
+ secs = self._D.second + self._D.microsecond/1000000.0
+ return self._D.strftime('%I:%M:') + '%06.3f ' % secs + self._D.strftime('%p')
def yy(self):
"""Return calendar year as a 2 digit string."""
- return str(self._year)[-2:]
+ # MIGRATED
+ return self._D.strftime('%y')
def mm(self):
"""Return month as a 2 digit string."""
- return '%02d' % self._month
+ # MIGRATED
+ return self._D.strftime('%m')
def dd(self):
"""Return day as a 2 digit string."""
- return '%02d' % self._day
+ # MIGRATED
+ return self._D.strftime('%d')
+
def rfc822(self):
"""Return the date in RFC 822 format."""
tzoffset = _tzoffset2rfc822zone(_tzoffset(self._tz, self._t))
Modified: Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.txt
===================================================================
--- Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.txt 2007-08-26 09:28:35 UTC (rev 79279)
+++ Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.txt 2007-08-26 09:46:40 UTC (rev 79280)
@@ -462,13 +462,13 @@
* ``AMPM()`` returns the time string for an object to the nearest second:
>>> dt.AMPM()
- '01:45:00 pm'
+ '01:45:00 PM'
* ``AMPMMinutes()`` returns the time string for an object not showing
seconds:
>>> dt.AMPMMinutes()
- '01:45 pm'
+ '01:45 PM'
* ``PreciseTime()`` returns the time string for the object:
@@ -478,7 +478,7 @@
* ``PreciseAMPM()``return the time string for the object:
>>> dt.PreciseAMPM()
- '01:45:00.000 pm'
+ '01:45:00.000 PM'
* ``yy()`` returns the calendar year as a 2 digit string
More information about the Zope-Checkins
mailing list