Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying Hours/Minutes and Midnight with AM/PM
Message
From
15/01/2008 12:47:09
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Displaying Hours/Minutes and Midnight with AM/PM
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01281962
Message ID:
01281962
Views:
50
I'm having trouble working midnight into this equation. I need it to be 'AM', but the way I have it written, midnight will be 'PM' and noon will be 'AM' if the iStartingAM is set to TRUE. Just the reverse of what I need. The scenario won't come up often, if ever, but I have to account for the possibility. These statements are in loops (iHour changes value), and there is more code inbetween, but but this should be enough to get the gist of it.
iHour = 24
m.StartingAM = .T.

REPLACE AppointmentTypeSetsEdit.DisplayTime WITH PADL(AppointmentTypeSetsEdit.Hour, 2, '0') ;
     + ':' + '00' + ' ' ;
     + IIF(iHour>=12 AND iHour<=24,IIF(m.StartingAM,'PM','AM'),'AM')

REPLACE AppointmentTypeSetsEdit.DisplayTime WITH PADL(AppointmentTypeSetsEdit.Hour, 2,'0') ;
     + ':' + PADL(AppointmentTypeSetsEdit.Minute, 2, '0') + ' ' ;
     + IIF(iHour>=12 AND iHour<=24,IIF(m.StartingAM,'PM','AM'),'AM')
Partial results...
.
.
.
23:00 PM  
23:15 PM  
23:30 PM  
23:45 PM  
24:00 PM  
24:15 PM  
24:30 PM  
24:45 PM  
01:00 AM  
.
.
.
Next
Reply
Map
View

Click here to load this message in the networking platform