Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 24:00 and 00:00?

Tags:

date

php

What is the difference between 24:00 clock and 00:00 clock. IMO 24:00 clock is the day before and 00:00 clock is the beginning of the new day. But I'm not really convinced and I'm new to date programming

Update: Here is what wikipedia article say about military time and style guide about how to deal with 24:00 and 00:00 confusion: http://en.m.wikipedia.org/wiki/24-hour_clock#section_1.

like image 366
Micromega Avatar asked Oct 25 '12 01:10

Micromega


People also ask

Are 0000 and 2400 the same?

So, now you know that the answer to “Is military time midnight 2400 or 0000?” is 0000. Though it is also a matter of preference. 2400 can also be used to indicate that it is midnight in military time, but it is less popular and more frequently used to refer to the end of a day.

Is 00 00 00 the start or end of a day?

Another convention sometimes used is that, since 12 noon is by definition neither ante meridiem (before noon) nor post meridiem (after noon), then 12am refers to midnight at the start of the specified day (00:00) and 12pm to midnight at the end of that day (24:00).

Is it 24 or 00?

Midnight is called 24:00 and is used to mean the end of the day and 00:00 is used to mean the beginning of the day.

Is 00 00 still the same day?

As the dividing point between one day and another, midnight defies easy classification as either part of the preceding day or of the following day. Though there is no global unanimity on the issue, most often midnight is considered the start of a new day and is associated with the hour 00:00.


2 Answers

There is no 24:00. It's just that PHP understands when you input 24:00, instead of throwing an error, or returning false (like before 5.3). If you tell PHP 24:00 today, it will understand 00:00 tomorrow. And they're both the same moment in PHP's time representation.

You can tell PHP it's 24:00, but when you ask PHP, it will always say 00:00. 24:00 is just another way of saying 00:00 the following day. There is no zero-length extra second (or something) between 23:59 and 00:00.

So, I don't understand when you say you can't schedule something for every Saturday at midnight, while you actually have two ways to schedule that: Fri 24:00 or Sat 00:00. No reason for using Sat 00:01.

like image 141
bfavaretto Avatar answered Nov 15 '22 08:11

bfavaretto


After 23:59 comes 0:00, not 24:00 Please see the code below, in php, as you put the 'php' tag:

echo date('G:i:s', mktime(0,0,0)) . "\n" ;
echo date('G:i:s', mktime(0,0,0)-1) . "\n" ;

It will display:

0:00:00
23:59:59
like image 21
Grzegorz Avatar answered Nov 15 '22 08:11

Grzegorz