This assumes that counting the afternoon hours from 1 to 12 is desired behaviour.

Thank you. Some sanity, at last.

And for those wondering whether this is some new-fangled technology not available at the time: the DateTime class was only formally introduced with PHP5.2, but you can do the exact same thing with strtotime() and date(), which have been around for a lot longer.

Never done any PHP myself but I would expect there would be some data/time library functions that can convert a unix time value to a string in the desired format? Seems like a pretty common need that would part of something like PHP

It is assumed that 12:00:00 does not represent the precise moment of the meridian, but some milliseconds thereafter. So, 12:00:01PM is as correct as 12:00:00PM, meridian be damned. You're right that it still can cause confusion as there is no standard. Perhaps the code should always add one minute to the time if ever out finds out to be "12:00". :-)

if you want to nitpick, someone, the Latin word would be like meridies, meridiem being like the accusative form.

From http://en.wikipedia.org/wiki/12-hour_clock:

The 12-hour clock is a time convention in which the 24 hours of the day are divided into two periods:[1] a.m. (from the Latin ante meridiem, meaning "before midday") and p.m. (post meridiem, "after midday").[2] Each period consists of 12 hours numbered: 12 (acting as zero),[3] 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11.

In the same vein: http://www.nist.gov/pml/div688/times.cfm

Are noon and midnight referred to as 12 a.m. or 12 p.m.?
This is a tricky question because 12 a.m. and 12 p.m. are ambiguous and should not be used.

To illustrate this, consider that "a.m." and "p.m." are abbreviations for "ante meridiem" and "post meridiem," which mean "before noon" and "after noon," respectively. Since noon is neither before noon nor after noon, a designation of either a.m. or p.m. is incorrect. Also, midnight is both twelve hours before noon and twelve hours after noon.

It is fair to say, however, that the shortest measurable duration after noon should be designated as p.m. For example, it would be applicable for a digital clock changing from 11:59:59 a.m. to 12:00:00 to indicate p.m. as soon as it the 12:00 appears, and not delay the display of the p.m. by a minute, or even a second. The same is true for midnight, but there is an added issue of which day midnight refers to (see below).

Hours of operation for a business or other references to a block of time should also follow this designation rule.
For example, a business might be open on Saturdays from 8 a.m. to noon or weekends from 3:30 p.m. until midnight.
Is midnight the end of a day or the beginning of a day?
When someone refers to "midnight tonight" or "midnight last night" the reference of time is obvious. However, if a date/time is referred to as "at midnight on Friday, October 20th" the intention could be either midnight the beginning of the day or midnight at the end of the day.

To avoid ambiguity, specification of an event as occurring on a particular day at 11:59 p.m. or 12:01 a.m. is a good idea, especially legal documents such as contracts and insurance policies. Another option would be to use 24-hour clock, using the designation of 0000 to refer to midnight at the beginning of a given day (or date) and 2400 to designate the end of a given day (or date).

So I'd say that the evidence lies in favour of "meridiem" regardless of the grammatical correctness of the word in this context. And of 12:00:00 m being technically correct for the infinitessimal period at exactly noon, but for practical purposes there is no point in doing it. Imagine an LCD clock - in the time that the "m" takes to appear, it will have become invalid, so don't bother. And for specifying "noon", since there is a hypothecated quantum granularity of time, we can assert that it probably can never actually be exactly noon, but always a small fraction of a Planck interval before or after, it is always either am or pm.

This is one of the reasons for me that the 24-hour format makes more sense, less ambiguity to work. Then again, It could be that it can never get a good gauge on whether it's morning or evening by looking at a 12-hour clock. Damn summers and winters.

"meridies" is the Latin word for "midday", and as usual, we refer to nouns by their nominative form, so this is the one in dictionaries.

The latin prepositions "ante" and "post", however, force the noun to be in accusative form, which happens to be "meridiem".
So please don't just cite Wikipedia and claim to have evidence. This is probably TRWTF ;)

TRWTF is definitely the murican AM/PM over-complication of it all. Why bother? Why not just give in and do like the rest of the world? The day starts at zero (00:00) and ends at 24 (24:00) because there are 24 hours in a day. Simple as that.

Please convert to the metric system already, so we can speak to each other without confusion... "1 inch is 0.083333333 feet" and "1 cup is 0.0625 gallons" who can keep track of those decimal values? How do you even remember if it's 0.0833 or 0.0625?

The dead swans lay in the stagnant pool.
They lay. They rotted. They turned
Around occasionally.
Bits of flesh dropped off them from
Time to time.
And sank into the pool's mire.
They also smelt a great deal.

Never done any PHP myself but I would expect there would be some date/time library functions that can convert a unix time value to a string in the desired format? Seems like a pretty common need that would part of something like PHP

FTFY. Also, as Sam pointed out, PHP does have date/time library functions that would have made doing this 'correctly' (I think we can all agree that the only 'correct' date format is the yyyy-mm-dd hh:mm:ss standard) trivial.

TRWTF is definitely the murican AM/PM over-complication of it all. Why bother? Why not just give in and do like the rest of the world? The day starts at zero (00:00) and ends at 24 (24:00) because there are 24 hours in a day. Simple as that.

Please convert to the metric system already, so we can speak to each other without confusion... "1 inch is 0.083333333 feet" and "1 cup is 0.0625 gallons" who can keep track of those decimal values? How do you even remember if it's 0.0833 or 0.0625?

I find it easier to remember 12 inches to the foot and 8 pints to the gallon which combines with 2 cups to the pint to give 16 cups to the gallon.

Of course, if you are worrying about the conversion between cups and gallons, you're probably doing something wrong. (Notably: why the hell are you measuring cooking ingredients - the normal stuff you measure in cups - in gallons?)

The dead swans lay in the stagnant pool.
They lay. They rotted. They turned
Around occasionally.
Bits of flesh dropped off them from
Time to time.
And sank into the pool's mire.
They also smelt a great deal.

The dead swans lay in the stagnant pool.
They lay. They rotted. They turned
Around occasionally.
Bits of flesh dropped off them from
Time to time.
And sank into the pool's mire.
They also smelt a great deal.

Of course, if you are worrying about the conversion between cups and gallons, you're probably doing something wrong. (Notably: why the hell are you measuring cooking ingredients - the normal stuff you measure in cups - in **gallons**?)

You are right - something is wrong when you measure in cups or gallons ;)
Different households have different cups - some even have different sized cups for coffee and for tea.

No, I wouldn't know which to use, I heard there is also a difference between dry and wet ounces, and that fact alone is enough for me to NOT trust those scales.
I recently saw a graph of how much sugar is in a coke bottle, but the coke bottle volume was measured in ounces (I think) and the amount of sugar in it was measured in cups - how is that in any way relevant to each other? You guys mix your scales all the time, and it is so confusing.

TRWTF is definitely the murican AM/PM over-complication of it all. Why bother? Why not just give in and do like the rest of the world? The day starts at zero (00:00) and ends at 24 (24:00) because there are 24 hours in a day. Simple as that.

Please convert to the metric system already, so we can speak to each other without confusion... "1 inch is 0.083333333 feet" and "1 cup is 0.0625 gallons" who can keep track of those decimal values? How do you even remember if it's 0.0833 or 0.0625?

I find it easier to remember 12 inches to the foot and 8 pints to the gallon which combines with 2 cups to the pint to give 16 cups to the gallon.

Of course, if you are worrying about the conversion between cups and gallons, you're probably doing something wrong. (Notably: why the hell are you measuring cooking ingredients - the normal stuff you measure in cups - in gallons?)

TRWTF is Americans using cups for measuring cooking ingredients.
Especially things like flour, which can vary in density quite significantly depending on if it's sifted, how well packed it is in the packed etc.

TRWTF is definitely the murican AM/PM over-complication of it all. Why bother? Why not just give in and do like the rest of the world? The day starts at zero (00:00) and ends at 24 (24:00) because there are 24 hours in a day. Simple as that.

Please convert to the metric system already, so we can speak to each other without confusion... "1 inch is 0.083333333 feet" and "1 cup is 0.0625 gallons" who can keep track of those decimal values? How do you even remember if it's 0.0833 or 0.0625?

The ONLY reason we have the metric system is because we're so pedantic on decimal-points of measurements. Which is great for working measurements of space and volume like designing a building. It's horrible for other uses like cooking, etc.

When using different measurements for different sizes, they don't have to be related. We can measure a person by feet. 6 and 1/3, 6 and 1/2, 6 and 1/4, 6 and 1/6. We have all those specifications with feet and inches.

If you still want to keep on this issue, then why 10s. Why don't we scale metric to a base that makes more sense. Nope, we chose 10s. 10 is a horrible number for fractions. 12 is much much better, 30 if you'd prefer using 1/5 over 1/4, 60 does it all but much harder to create a character system for. What's 1/4, 1/3, 1/6 of 10?

When cooking, do you measure your ground herbs by liter? I suppose you could do milliliter, or worse "cubic-centimeter", but have you compared recipes in metric vs. "standard"?

The reason standard exists is because we used to measure by what made sense for the size/scale/object. Now we want all our measurements to relate so it's easier to compare. But outside of engineering, do you really need to compare the weight of your eggs to a skyscraper?

Addendum (2013-07-09 10:18):
10 was a number we should have abandoned when we could start recording amounts. 10 is only useful because we only have 10 fingers. What's the fractional granularity of 10. 1/10, 1/5, 1/2. That's it. 1, 2, and 5. With 12 we get 1/12, 1/6, 1/3, 1/4, 1/6, or 1, 2, 3, 4, and 6. We only miss 5.

It's much easier for humans to use fractions of 1/x or (x-1)/x. Other fractions are meaningless when we hear them. How do you compare 5/12 to 1/3 or 2/3? Takes a second?

How do you compare 4/10 to 9/10? We can compare 4/10 to 8/10 quickly because 4/8 is 1/2. But 4/9? Not that useful.

You are right - something is wrong when you measure in cups or gallons ;)
Different households have different cups - some even have different sized cups for coffee and for tea.

Take a FAIL point, dude. Whenmeasuringliquids a cup is a unit of measure, equal to half a pint. Of course that means a US cup is about 5/6 of an Imperial cup, because the corresponding pints are in about that ratio. (And, worse, they aren't the same number of fluid ounces, because a US pint is 16 US fluid ounces, while an Imperial pint (the only way to measure beer, even if you call it 568ml) is 20 Imperial fluid ounces.)

miko:

No, I wouldn't know which to use, I heard there is also a difference between dry and wet ounces, and that fact alone is enough for me to NOT trust those scales.

It's easy. A dry ounce is a unit of force, usually used for weights, while a fluid (not wet) ounce is a unit of volume.

miko:

I recently saw a graph of how much sugar is in a coke bottle, but the coke bottle volume was measured in ounces (I think) and the amount of sugar in it was measured in cups - how is that in any way relevant to each other? You guys mix your scales all the time, and it is so confusing.

Which 'you guys' are you talking about? You obviously haven't been paying attention. I'm an Englishman living in France. My everyday life (vie quotidienne?) is in metric, although I'll admit to still thinking of terrestrial distances and speeds in miles.

Actually, water turns to gas at any temperature below the critical point, if the partial pressure of water vapour is low enough. It's called evaporation above the melting point, and sublimation below. You meant to say that water *boils* at 100 degrees centigrade. (And that centigrade part is important because the F scale is also degrees. Alternatively, go 100% SI, where water melts (at standard pressure) at 273.15 K (not degrees, because the kelvin unit is not a degrees unit).)

TRWTF is Americans using cups for measuring cooking ingredients.
Especially things like flour, which can vary in density quite significantly depending on if it's sifted, how well packed it is in the packed etc.

I agree 100% with that. However the US tendency to measure liquids in recipes in cups is why I still have some US cup-fraction measuring scoops at home. It's moderately annoying.

A fail to be sure. Proof that even a basic unit test goes a long way. Reminds me of a co-worker who wrote a circle drawing routine that generated over a billion points in one of the paths through the code. An epic fail that could have been caught with a simple unit test that exercised all the paths through the code.

TRWTF is Americans using cups for measuring cooking ingredients.
Especially things like flour, which can vary in density quite significantly depending on if it's sifted, how well packed it is in the packed etc.

I agree 100% with that. However the US tendency to measure liquids in recipes in cups is why I still have some US cup-fraction measuring scoops at home. It's moderately annoying.

Take a FAIL point, dude. Whenmeasuringliquids a cup is a unit of measure, equal to half a pint. Of course that means a US cup is about 5/6 of an Imperial cup, because the corresponding pints are in about that ratio. (And, worse, they aren't the same number of fluid ounces, because a US pint is 16 US fluid ounces, while an Imperial pint (the only way to measure beer, even if you call it 568ml) is 20 Imperial fluid ounces.)

See, this is why I don't understand bashing the standard system.

If you are stubborn enough to insist that 1 -> 10 is superior in every way. Why abandon that and convert 568ml to 20?

At that point you basically reintroduced the standard system, which is measure by whatever makes sense and not worry about being able to convert.

Do you really need to know how much beer it would take to fill the pipes in the water treatment plant?

No... You need a way to personally track how much beer it takes to get intoxicated. Which is best measurable in drinks, which is measured per drink type by alcohol content over total volume.

For example, you have a separate cup for shots than wine, and it's not just for style. Do you really want to drink wine in shot glasses, or shots in wine glasses.