Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime gotcha
Message
From
29/11/1999 11:56:15
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
29/11/1999 11:40:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00296388
Message ID:
00296399
Views:
25
>
lparameters tc2File, tnShift
>if type("tnShift") # "N"
>  tnShift = 0
>endif
>lcFrom1 = getfile("DBF","Info dosyasi ?")
>lcFrom2 = getfile("DBF","Velocity dosyasi ?")
>select ;
>	dtot(a.date_b) + ;
>		int(a.tb)*3600 + ;
>		((a.tb - int(a.tb)) * 100 * 60 ) ;
>		AS tDT, ;
>	B.Vel ;
>	from (lcFrom1) a, (lcFrom2) b ;
>	where  a.cm_code = b.cm_CODE ;
>	into table (tc2File)
>replace all tdt with ( tdt+(recno()-1)*3600 ) + tnShift
>
>Run the code and browsed the tables proudly again showing them all data now had tnShift mins shift and could be joined easily. I forgot one little point. VFP stores datetime as real values not as YYYYMMDD... as in date type :( When I did the SQL (which I thought a child could do too) I got 0 records !
>
>Only moving "+ tnShift" into SQL corrected the problem (before "as tdt").
>Cetin

Actually, datetime() stores the date as integer Julian date (first 4 bytes) and milliseconds after midnight (other 4 bytes), though in operation it treats them as seconds. So you should be adding 3600 to what was already in there, or whatever other process you use to get around this - even if it includes replacing all datetimes with ctot(ttoc(datetimefield)), which would round it to whole seconds. Actually, there are a thousand different datetimes which have the same ttoc() representation...

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform