[New-bugs-announce] [issue10427] 24:00 Hour in DateTime
report at bugs.python.org
Mon Nov 15 15:38:00 CET 2010
New submission from ingo janssen <ingoogni at gmail.com>:
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[,
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.
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 <report at bugs.python.org>
More information about the New-bugs-announce