Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Displaying Hours/Minutes and Midnight with AM/PM
Message
De
15/01/2008 23:58:11
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
15/01/2008 12:47:09
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01281962
Message ID:
01282121
Vues:
12
>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...
SET HOURS TO 12
SET SECONDS OFF
for nHour=0 to 23
   for nMinute= 0 to 45 step 15
      tT=datetime(2008,1,1,nHour, nMinute,0)
*-- this'll be the character interpretation of the time as the non-ANSI standard has it:
      insert into  ... value (... RIGHT(tT),8))
   endfor
endfor
[update] This is how VFP's automatic display handles it, and for some reason it thinks the time between midnight and 0:59 is actually 12:00 AM to 12:59 AM. If you're fine with that, OK, if you need it to be 0:00, 0:15, 0:30, 0:45, you may need to loop from 1 to 23, not from 0 to 23, and handle this one hour manually.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform