Amigos. necesito saber si la hora es AM o PM, tengo las hora en un campo caracter ejemplo
23:45
04:50
15:00
16:07
21:08
09:00
10:00
19:00
18:50
asi lo tengo
como saber si es AM o PM
12:00 midnight 00:00
1:00 am 01:00
2:00 am 02:00
3:00 am 03:00
4:00 am 04:00
5:00 am 05:00
6:00 am 06:00
7:00 am 07:00
8:00 am 08:00
9:00 am 09:00
10:00 am 10:00
11:00 am 11:00
12:00 noon 12:00
1:00 pm 13:00
2:00 pm 14:00
3:00 pm 15:00
4:00 pm 16:00
5:00 pm 17:00
6:00 pm 18:00
7:00 pm 19:00
8:00 pm 20:00
9:00 pm 21:00
10:00 pm 22:00
11:00 pm 23:00
12:00 midnight 24:00
James Bott wrote:Rick,
Well I see that you have a strange chart, which I am guessing that you got from militarytime.com. We humans do have a tendency to make things more complicated than they should be.
As a programmer we have to just fix the illogical to logical and then do the calculation. So, we can just pick one time number (either 00:00 or 24:00) and convert it to the other, then do the calculation.
Lucky for us, both Harbour and xHarbour already have a function to convert military time to AMPM format (jbrita already pointed this out above). It is ampm( cMilitaryTime ). Here are the results:
msgInfo( ampm("24:00") ) // returns 12:00 am
msgInfo( ampm("00:00") ) // returns 12:00 am
So, it doesn't matter which time format you use, it works.
Regards,
James
Rick Lipkin wrote:James
I get what you are saying .. however, I need to convert clock time am\pm to military time .. and when you have 12:00 am 00:00 and 12:00 pm 24:00 you cannot tell which side of the day you are on .. as in the reservation example
10:00 pm to 12:00 midnight ... is 12 midnight am or pm ? 24:00 or 00:00
and the next reservation starts as the old reservation ends
12:00 midnight ( am or pm ? 00:00 or 24:00 ) to 3:00 am
How do you know what is the military value of 12:00 midnight .. is 12:00 midnight am or pm .. and then how do you convert 12:00 midnight to military time .. is it 00:00 or 24:00 ?
That is why ( see image above ) I added MN to the combobox .. so that the data entry is clear and I knew what side of midnight I was on .. MN or AM .. 24:00 or 00:00
An interesting paradox.
Rick Lipkin
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 97 guests