Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the best way to hande TIME in vfp50a?
Message
De
31/08/1997 04:33:47
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
29/08/1997 09:55:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00047460
Message ID:
00047842
Vues:
28
> Thanks Michel - but what if the user enters > 44:88. I will have to set up a VALID to > check for user entry. I was hoping there was > function that checks for a valid time. I guess > I will have to write my own..I must have written > at least 1000 functions maybe more...rob Ok, try this one. It works for fpd2.6, but converting it to VFP should take you couple of minutes. The _tim parameter should contain 4 digits, not necessarily filled (i.e. "7 " will get converted into "0700"). "Poruka" means "message". You should call this by ref, so _tim will get corrected (reformatted, and times like 1375 converted to 1415). Varr() is the "variable read" in fpd2.6 - if you make a time class out of this, replace it with this.value. para _tim, z5 C_1h ='' C_24h ='On Earth, day has 24 hours.' C_letit ='Let it go as ' C_min =' minutes?' C_neg ='Negative hours?' * if z5 - round to 5 minutes * sati=hours, minuta=minutes priv _noparams, sati, minuta, _varr _noparams= para()=0 if _noparams _tim=eval(varr()) endif sati=val(left(_tim,2)) minuta=val(right(_tim,2)) _tim=tran(sati,'@L 99')+tran(minuta,'@L 99') _vld=.t. do case case sati < 0 _vld=poruka(c_neg) case _tim="2400" case (sati=24 and minuta > 0) or sati>23 _vld=poruka(c_24h) case minuta=60 _tim=tran(sati+1,'@L 99')+'00' _vld=poruka(c_letit+tran(_tim,'@R 99:99')) or .t. case !betw(minuta,0,59) _vld=poruka(c_1h+str(minuta,2,0)+c_min) case minuta % 5 # 0 and z5 minuta = round(minuta*2,-1)/2 if minuta=60 _tim=tran(sati+1,'@L 99')+'00' else _tim=stuff(_tim,3,2,tran(minuta,'@L 99')) endif endc retu _vld

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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform