Should i use 23:59:59 or 00:00:00 for 12 AM in 24 hours time format?

24 hour to 12 hour converter
how to convert 12 to 24 hour time in c
24 hour clock calculator
24 hour clock conversion table
24 hour clock time
24 hour clock online
24 hour time now
converting 12 and 24 hour time

When I search about maximum time. people always answering that from VS debugger. which is 23:59:59.9999999

As I need 12 AM in 24 formats. I guess it will be 00:00:00 but... C# .NET assume the following:

var xx = DateTime.MaxValue.ToString("HH:mm:ss.fffffff");

When debugging previous it will print 23:59:59.9999999

What should I use? does it matter? what's the difference?

Should use 00:00:00 ? or 23:59:59.9999999 Specially when saving Time in SQL-Server.

The big problem or I mean un-good behavior for end-user when you convert 24 formats to 12 Hour format via hh:mm:ss it will show 11:59:59 PM it will be ugly isn't it? it should be 12:00:00 AM.

After All, Obsidian Age answered this well depending on the use case.

It depends on perspective:

var xx = DateTime.MaxValue.ToString("HH:mm:ss.fffffff");
var xy = DateTime.MinValue.ToString("HH:mm:ss.fffffff");




So, one is the end of the day and the other is the beginning of the day.

There's an interesting novel called 'The time between midnight'

24-hour clock, In the US, the time of day is customarily given almost exclusively using the 12- hour clock notation, which counts the hours of the day as 12, 1, , 11 with suffixes � Hour values from 13 through 23 represent hours after noon if AM or PM is not specified. The values also represent the hours after noon when PM is specified. AM cannot be specified when the hour value is from 13 through 23. An hour value of 24 is not valid. To represent midnight, use 12:00 AM or 00:00.

DateTime.MaxValue is exactly that - the maximum value that DateTime can represent; that is to say, the 'last' point in a day. Conversely, the .Date property makes use of 00:00:00 by default, as it has no notion of time (unless specified).

If you have an event that occurs at exactly midnight, I would recommend storing it as 00:00:00, as the event occurs at midnight, and you want to accurately represent that.

Ultimately, it really depends on your desired use case as to which one you want to use. Do you want to state that the event occurs on day 1's evening, or day 2's beginning? That is what it boils down to, although in the vast majority of cases such a delineation makes no difference. In this case you would want to opt for both the accuracy and 'ease' of 00:00:00.

24-hour clock, The 24-hour clock is a way of telling the time in which the day runs from midnight to It does not use a.m. or p.m. This system is also referred to (only in the US and the Also, the international standard notation of time (ISO 8601) is based on this format. People do not have to figure out if noon is 00h00.m. or 12h00.m. To convert the time format from 24 hour to 12 hour, please type this formula: =TEXT(A2,"hh:mm:ss AM/PM") into a blank cell to locate the result, and drag the fill handle down to the cells that you want to contain this formula, and all the 24 hour time format cells have been converted to 12 hour format, see screenshot:

programmatically speaking, you can do both. the only difference between them (in code) is this :

 // using 00:00:00 will require you to add 1 day to the end date in order to count as full day
 if(time >= "2019-12-03 00:00:00" && time < "2019-12-04 00:00:00")

//using 23:59:59 will not require you to add 1 day to the end date.
 if(time >= "2019-12-03 00:00:00" && time <= "2019-12-03 23:59:59")

so, basically, if you use 23:59:59 there is a one second off the grid, if any record has been stored in this second, it'll not be included in the results. while the second one will include it.

Which one to use ? surely the 00:00:00 if you want to be more precise, however, I've not seen any difference in the results in my projects as I've used both of them in different projects. But I'm sure there are some projects needs to include every micro second as this microsecond could change the result's curve (such as analytics or deep learning ..etc).

In SQL Server, don't save the time as string, save it with the correct datatype (DateTime, TimeSpan ..etc). SQL Server will reads the time perfectly fine when you pass a correspond time datatype from your application.

24 Hour Clock Converter: How to Convert AM/PM to 24 Hour Time, In the 12 hour clock method, it is 12:00 twice a day at midnight (AM) and noon ( PM). The table below shows the conversion between the 12 hour� The hour in a 12-hour clock. Single-digit hours do not have a leading zero. The application specifies "%h" if the format pattern is not combined with other format patterns. hh . The hour in a 12-hour clock. Single-digit hours have a leading zero. H, %H. The hour in a 24-hour clock. Single-digit hours do not have a leading zero.

The Time - Converting AM/PM to 24 Hour Clock, It is better to use: 11:59 PM or 12:01 AM, or. 23:59 or 00:01 (24-Hour Clock) 00:00:00 is stored as 0.0; 23:59:59 is stored as 0.99999; 06:00 AM is 0.25; 12:00 PM is 0.5; When both a date and time are entered in a cell, they are stored as a decimal number comprised of an integer representing the date and a decimal portion representing the time. For example, 1 June 2015 9:30:00 AM is stored as 42156.3958333333.

Military Time Chart, It is based on a 24 hour clock, and is a method of keeping hours in which the day You may use this as a military time converter, or reference it as a military time 12 hour clock vs military time would be a time table showing 4:00 pm to 12:00� This is because parsing methods that use a custom format string can't parse the string representation of date and time values that lack a time zone component or use "Z" to indicate UTC. The following example uses the "o" format specifier to display a series of DateTime values and a DateTimeOffset value on a system in the U.S. Pacific Time zone.

12 hour to 24 hour Converter, Convert to and from the 12 hour time format and the 24 hour military time format. From 1:00 PM to 11:59 PM you add 12 hours, and from 12:00 AM (midnight) Or you can simply use the following calculator to convert to or from either system. Valid time values range from .0 (00:00:00) to .99999 (23:59:59). The numeric value represents a fraction of one day. You can convert the numeric value to hours, to minutes, and to seconds by multiplying the numeric value by 24. The following table shows how Access stores Date/Time values:

Dealing with Midnight Ending a Day (Microsoft Excel), There are only 24 hours in a day, and those hours are numbered 0 through 23, not 1 through 24. So when you "tick over" from 23:59:59, the time becomes 00:00: 00. Just as each hour starts with zero seconds, the day should, as well. parses it as a date and time, converting it to 5/20/2020 12:00:00 AM. For example, if the date is accessed at 23:59.59 and then time is then accessed, the time may have changed to 00:00.00 (the following day) and the date won't be correct for the time. Use the timestamp or the [timeanddate.numericTime()] block to get numeric values for the date.

  • I guess that there is no 12 pm. Like the is no 24:00. We have 02.12 23:59:59.9999999 and after one micro-second we have 03.12 00:00:00.00000000. The analogy for weeks will be: What is 8 day of the week?
  • @BasilKosovan You would guess wrong, they even use 12:15 PM. Imagine using a zero. And yes, for midnight it would be 12 AM, the day start :)
  • It's 12AM not 12PM you are talking about. And 12AM is 00:00:00 in 24 hour format.
  • I would avoid using 12 AM and 12 PM altogether to prevent confusion -- the time you're talking about is midnight. Where possible, do not rely on "the last possible time in the day" at all, because (especially when using DATETIME, which has limited accuracy) you can run into problems representing this value, or having it rounded. Storing that many 9s needs a TIME(7), which is wasteful if you don't actually need that much precision.
  • What is even being asked here? It seems to be about midnight or the second just before, but then it claims that's equal to 12:00:00 PM, which is wrong. It asks about formats with both fractional and whole seconds. It seems to be about the format displayed to the end user, but then adds "Specially when saving Time in SQL-Server", to which formatting wouldn't apply. If you're displaying time to the second and the time is 11:59:59 PM then just display that; why would you change it to something else? Does 11:59:58 PM get changed, too, or where's the threshold? Why is 11:59:59 PM "ugly"?
  • but IDK why you do string comparison with timespan? can you give real-example in c#
  • When comparing from 00:00 to 00:00, the range should be treated as half-open (inclusive at the front, exclusive at the end). I edited your answer to use < instead of <= accordingly.