Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to translate timestamp in .VCX to date/time
Message
From
18/01/2001 13:18:59
 
 
To
18/01/2001 12:21:58
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00465211
Message ID:
00465251
Views:
39
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform