Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting time
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00411789
Message ID:
00411824
Vues:
9
>I have a time field that is a character field.
>It is length 6 and in the format hhmmss.
>The problem is that it is in military time and I need it in standard time,, so 133245 would need to be 013245.
>I am not sure how to convert it.
>Thanks for any help,

Ryan,

Try this;
FUNCTION ConvTime(pcTime)
LOCAL lnHours
lnHours = VAL(LEFT(pcTime,2))
IF lnHours > 12
   lnHours = lnHours - 12
   pcTime = PADL(ALLTRIM(STR(lnHours,2)),2,"0") + SUBSTR(pcTime,3)
ENDIF
RETURN pcTime
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform