Skip to content

Commit

Permalink
- Launchpad #142521: Removed confusing special case in
Browse files Browse the repository at this point in the history
  DateTime.__str__ where DateTime instances for midnight   
  (e.g. '2010-07-27 00:00:00 US/Eastern') values would   
  render only their date and nothing else.
  • Loading branch information
dataflake committed Jul 27, 2010
1 parent e5b2463 commit 00a7b4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,10 @@ Changelog
2.12.5 (unreleased)
-------------------

- Launchpad #142521: Removed confusing special case in
DateTime.__str__ where DateTime instances for midnight
(e.g. '2010-07-27 00:00:00 US/Eastern') values would
render only their date and nothing else.

2.12.4 (2010-07-12)
-------------------
Expand Down
5 changes: 1 addition & 4 deletions src/DateTime/DateTime.py
Expand Up @@ -1676,10 +1676,7 @@ def __str__(self):
"""Convert a DateTime to a string."""
y,m,d = self._year,self._month,self._day
h,mn,s,t = self._hour,self._minute,self._second,self._tz
if h == mn == s == 0:
# hh:mm:ss all zero -- suppress the time.
return '%4.4d/%2.2d/%2.2d' % (y, m, d)
elif s == int(s):
if s == int(s):
# A whole number of seconds -- suppress milliseconds.
return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % (
y, m, d, h, mn, s, t)
Expand Down
2 changes: 1 addition & 1 deletion src/DateTime/DateTime.txt
Expand Up @@ -314,7 +314,7 @@ Conversion and comparison methods
the current object's day, in the object's timezone context:

>>> dt.earliestTime()
DateTime('1997/03/09')
DateTime('1997/03/09 00:00:00 US/Eastern')

* ``latestTime()`` return a new DateTime object that represents the
latest possible time (in whole seconds) that still falls within the
Expand Down

0 comments on commit 00a7b4c

Please sign in to comment.