comparison roundup/date.py @ 206:1eb862f4bf56

Changed date.Date to use regular string formatting instead of strftime. win32 seems to have problems with %T and no hour... or something...
author Richard Jones <richard@users.sourceforge.net>
date Sun, 05 Aug 2001 07:46:12 +0000
parents a44c70b25369
children d45384bc6420
comparison
equal deleted inserted replaced
205:da2e5d340e14 206:1eb862f4bf56
1 # $Id: date.py,v 1.7 2001-08-02 00:27:04 richard Exp $ 1 # $Id: date.py,v 1.8 2001-08-05 07:46:12 richard Exp $
2 2
3 import time, re, calendar 3 import time, re, calendar
4 4
5 class Date: 5 class Date:
6 ''' 6 '''
138 if r: return r 138 if r: return r
139 return 0 139 return 0
140 140
141 def __str__(self): 141 def __str__(self):
142 """Return this date as a string in the yyyy-mm-dd.hh:mm:ss format.""" 142 """Return this date as a string in the yyyy-mm-dd.hh:mm:ss format."""
143 return time.strftime('%Y-%m-%d.%T', (self.year, self.month, self.day, 143 return '%4d-%02d-%02d.%02d:%02d:%02d'%(self.year, self.month, self.day,
144 self.hour, self.minute, self.second, 0, 0, 0)) 144 self.hour, self.minute, self.second)
145 145
146 def pretty(self): 146 def pretty(self):
147 ''' print up the date date using a pretty format... 147 ''' print up the date date using a pretty format...
148 ''' 148 '''
149 return time.strftime('%e %B %Y', (self.year, self.month, 149 return time.strftime('%e %B %Y', (self.year, self.month,
361 if __name__ == '__main__': 361 if __name__ == '__main__':
362 test() 362 test()
363 363
364 # 364 #
365 # $Log: not supported by cvs2svn $ 365 # $Log: not supported by cvs2svn $
366 # Revision 1.7 2001/08/02 00:27:04 richard
367 # Extended the range of intervals that are pretty-printed before actual dates
368 # are displayed.
369 #
366 # Revision 1.6 2001/07/31 09:54:18 richard 370 # Revision 1.6 2001/07/31 09:54:18 richard
367 # Fixed the 2.1-specific gmtime() (no arg) call in roundup.date. (Paul Wright) 371 # Fixed the 2.1-specific gmtime() (no arg) call in roundup.date. (Paul Wright)
368 # 372 #
369 # Revision 1.5 2001/07/29 07:01:39 richard 373 # Revision 1.5 2001/07/29 07:01:39 richard
370 # Added vim command to all source so that we don't get no steenkin' tabs :) 374 # Added vim command to all source so that we don't get no steenkin' tabs :)

Roundup Issue Tracker: http://roundup-tracker.org/