Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to translate timestamp in .VCX to date/time
Message
De
18/01/2001 13:18:59
 
 
À
18/01/2001 12:21:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00465211
Message ID:
00465251
Vues:
43
This message has been marked as the solution to the initial question of the thread.
>Hi, all -
>
>Anyone out there know how to translate the timestamp in a .VCX to date/time?
>
>- George

From HackFox (renamed the function to TS2DT)
Function TS2DT(tnStamp)
     *--     TS2DT = TimeStamp -> DateTime
     #define SecondsMask 15
     #define MinutesMask 63
     #define HoursMask     31
     #define DaysMask     31
     #define MonthsMask     15
     #define YearsMask     63

     #define SecondsOffset     1
     #define MinutesOffset     5
     #define HoursOffset          11
     #define DaysOffset          16
     #define MonthsOffset     21
     #define YearsOffset          25

     #define fMonth          BitAnd(BitRShift(tnStamp,MonthsOffset     ), MonthsMask)
     #define fDay          BitAnd(BitRShift(tnStamp,DaysOffset          ), DaysMask)
     #define fYear          1980+BitAnd(BitRShift(tnStamp,YearsOffset     ), YearsMask)
     #define fHours          BitAnd(BitRShift(tnStamp,HoursOffset     ), HoursMask)
     #define fMinutes     BitAnd(BitRShift(tnStamp,MinutesOffset     ), MinutesMask)
     #define fSeconds     BitAnd(BitLShift(tnStamp,SecondsOffset     ), SecondsMask)
     Local ltReturn
     ltReturn = IIf(tnStamp=0, {//::}, ;
          DateTime(fYear, fMonth, fDay, fHours, fMinutes, fSeconds))
     Return ltReturn

EndFunc
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform