What is the best format for one day?

How to imagine the start and end time in one day?

Using October 23, 2008 as an example, does it start from 2008-10-23 to 12:00:00 and end 2008-10-23 11:59:59 PM?

+4
source share
7 answers

Your notes are weird. I would suggest a standard way to determine the full daily range:

2008-10-23 00:00:00 and finish 2008-10-23 23:59:59

+1
source

I would like to bring the site, http://www.cl.cam.ac.uk/~mgk25/iso-time.html

International Standard Time Notation

hh:mm:ss 

where hh is the number of full hours that have passed since midnight (00-24), mm is the number of full minutes that have passed since the beginning of the hour (00-59), and ss is the number of full seconds since the beginning of the minute (00-60). If the hour value is 24, then the minute and second values ​​should be zero.

Note. A value of 60 for ss may sometimes be required during the inserted second of a jump in the atomic time scale, such as coordinated universal time (UTC). Every few years, a single jump of 23:59:60 is introduced in the UTC timeline, as announced by the International Earth Rotation Service in Paris, so that UTC deviation from more than 0.9 s from the less constant astronomical time scale UT1, which is determined by the actual rotation Of the earth. In practice, you are unlikely to see a clock showing 23:59:60. Most synchronized clocks are re-synchronized again in UTC some time after the jump occurred, or they temporarily slow down almost during the jumping seconds to avoid any malfunction that could cause the time stamp out of range.

Approximate time

 23:59:59 

which represents the time one second before midnight.

As for date, the colon separators can also be omitted, as in

 235959 

and accuracy can be reduced by omitting seconds or both seconds and minutes, as in

 23:59, 2359, or 23 

You can also add fractions of a second after the decimal point or comma, for example, the time 5.8 ms before midnight can be written as

 23:59:59.9942 or 235959.9942 

As each day begins and ends at midnight, two entries 00:00 and 24:00 are available in order to distinguish between two full nights, which can be associated with one date. This means that the following two entries relate exactly to the same point in time:

 1995-02-04 24:00 = 1995-02-05 00:00 

In the event that an explicit presentation of time is required, 00:00 is usually the preferred designation for midnight rather than 24:00. The digital clock shows 00:00, not 24:00.

ISO 8601 does not indicate whether its designation indicates a point in time or a period of time. This means, for example, that ISO 8601 does not determine whether 9:00 refers to the exact end of the ninth hour of the day or the period from 09:00 to 09:01 or something else. Users of the standard must somehow agree on an accurate interpretation of the time symbols, if this should be related to the problem.

If the date and time are displayed on the same line, always indicate the date before the time. If the date and time are stored together in one data field, then ISO 8601 suggests that they should be separated by a Latin capital letter T, as in 19951231T235959.

Note to US readers:

The 24-hour notation referenced here has already been the de facto standard in written language for decades. The only exceptions are several English-speaking countries, where there are still entries with hours from 1 to 12 and additions such as “m.” And “are widely used. The usual 24-hour international standard notation is widely used even now in England (for example, in airports, cinemas, bus and train schedules, etc.). Most other languages ​​do not even have abbreviations like "and" and the 12th notation, of course, is hardly ever used in continental Europe to write or display time. Even in the US military and programmers before Goa time using 24-hour notation.

There are many drawbacks to the old English 12-hour notation, such as:

  • This is longer than the normal 24-hour notation.
  • It takes a little longer for people to compare twice in 12-hour notation.
  • It is not clear how 00:00, 12:00 and 24:00 are presented. Even encyclopedias and style guides contain conflicting descriptions, and the usual quick fix seems to be to avoid "12:00 an hour." and write “noon,” “midnight,” or “12:01 in the morning.” instead, although the word "midnight" still does not distinguish between 00:00 and 24:00 (midnight at the beginning or at the end of the day).
  • This often leads people to believe that the next day begins with an overflow at 12:59 a.m. until "1:00 a.m.", which is a common problem not only when trying to program the VCR timer shortly after midnight.
  • This is not easy to compare with the string comparison operation.
  • It is unclear whether the time between 12:00 per hour is not known. and "1 am". starts at 00:00 or at 12:00, i.e. English 12-hour notation is more difficult to understand.

Please think that at a 12-hour time, to be a relic from the dark ages when Roman numerals were used, the zero number had not yet been invented, and analog clocks were the only known form of time display. Please do not use it today, especially in technical applications! Even in the US, the widely respected Chicago style guide now recommends using the international standard time notation in publications.

+15
source

Of course, if you just want to introduce 1 day, you don’t need to include time at all, especially since it raises this level of discussion about when the day starts or ends. In my experience, date processing is usually quite complicated, without any additional complexity.

Today is October 20, 2008 - No more information is required.

Or am I missing something?

+4
source

October 23 starts at 2008-10-23 12 am and ends at 2008-10-24 12 AM - the day ends at the same point as the next. The very last second starts at 11:59:59 PM, but you still have a whole second before the day ends.

+2
source

The definition of the day that you mention in the question is any time that is> = 2008-10-23 00:00:00 and <2008-10-24 00:00:00.

+1
source

If you must use notation with a mathematical interval, you must write it as

[2008-10-23 00:00:00, 2008-10-24 00:00:00)

[ means inclusion, a ) means before, but not including.

Thus, you simplify the users and yourself.

+1
source

It depends on what you mean by one day. Date processing, unfortunately, is always more complicated than it looks.

To convert your example to a 24h date format, you would say:

 2008-10-23 00:00:00 - 2008-10-23 23:59:59 

However, depending on whether you interpret the range as inclusive or exclusive, which may omit the last second of the day *. Programmers usually prefer to maintain an exclusive upper bound, so you should look for:

 2008-10-23 00:00:00 - 2008-10-24 00:00:00 

Or, as a slightly nicer way of saying the same thing, if supported (or for readability):

 2008-10-23 00:00:00 - 2008-10-23 24:00:00 

*: in fact, more than one is possible. If the interval is a day in the UTC time zone (or another time zone corresponding to it, which is quite likely), sometimes an additional “second jump” may appear at the end of the day, 23:59:60, try to keep the UTC in accordance with the sidereal time. The next second jump is scheduled for the end of this year. However, many systems ignore leap seconds because they are stupid and annoying.

If you want to represent a "calendar day" regardless of time zones, the best option would be a Julian day number. Today 2454760.

+1
source

All Articles