Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another date time format
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00936800
Message ID:
00937178
Vues:
11
>FUNCTION SomeFunc()
>LPARAMETERS cDateTimeStr
>
> LOCAL ltRetVal, lnYear, lnMonth, lnDay, lnHours, lnMinutes, lnSeconds
>
> lnYear = VAL(SUBSTR(cDateTimeStr, 1, 4))
> lnMonth = VAL(SUBSTR(cDateTimeStr, 6, 2))
> lnDay = VAL(SUBSTR(cDateTimeStr, 9, 2))
> lnHours = VAL(SUBSTR(cDateTimeStr, 12, 2))
> lnMinutes = VAL(SUBSTR(cDateTimeStr, 15, 2))
> lnSeconds = VAL(SUBSTR(cDateTimeStr, 18, 2))
>
> ltRetVal = DATETIME(lnYear, lnMonth, lnDay, lnHours, lnMinutes, lnSeconds)
>
>RETURN ltRetVal

Thanks, I like this one better as it handles the datetime no matter the local date settings.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform