[issue10427] 24:00 Hour in DateTime

2010-11-21 Thread ingo janssen

ingo janssen  added the comment:

On Sun, Nov 21, 2010 at 7:24 PM, Rodrigo Bernardo Pimentel wrote:

> I would say those aren't valid, although that makes checking forvalid hour 
> values slightly weird
>(as in not straightforward): 24 is valid if minutes, seconds and microseconds 
>are all 0, but invalid
>otherwise.

Indeed anything beyond 24:0:0 is invalid

ingo

--

___
Python tracker 
<http://bugs.python.org/issue10427>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10427] 24:00 Hour in DateTime

2010-11-15 Thread ingo janssen

New submission from ingo janssen :

Short:
make the DateTime class and related also accept 24 for the hour instead of 
stopping at 23:59:59.

from the python doc:

"class datetime.datetime(year, month, day[, hour[, minute[, second[,
microsecond[, tzinfo])
The year, month and day arguments are required. tzinfo may be None, or
an instance of a tzinfo subclass. The remaining arguments may be ints
or longs, in the following ranges:
[...]
0 <= hour < 24
[...]
If an argument outside those ranges is given, ValueError is raised."


from http://en.wikipedia.org/wiki/ISO_8601 :

"ISO 8601 uses the 24-hour clock system. The basic format is
[hh][mm][ss] and the extended format is [hh]:[mm]:[ss].

* [hh] refers to a zero-padded hour between 00 and 24 (where 24 is
only used to notate midnight at the end of a calendar day).
[...]
Midnight is a special case and can be referred to as both "00:00" and
"24:00". The notation "00:00" is used at the beginning of a calendar
day and is the more frequently used. At the end of a day use "24:00".
Note that "2007-04-05T24:00" is the same instant as "2007-04-06T00:00"
(see Combined date and time representations below)."

The use of 24:00 is very comfortable when using hourly datasets, the
first set of a day is saved under 1:00, the fifth (4:00 to 5:00) under
5:00 and the last (23:00 - 24:00) under 24:00. No need to suddenly use
23:59:59 or 0:00 the next day. 

Actually in another part of Python SQLlite's date and time functions accept and 
outputs the 24:00. Adding some Python to an existing database made me aware of 
the problem.

--
messages: 121230
nosy: ingo.janssen
priority: normal
severity: normal
status: open
title: 24:00 Hour in DateTime
type: feature request
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 
<http://bugs.python.org/issue10427>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com