Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(2015) to Date Time
Message
From
24/10/2002 06:29:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
24/10/2002 06:13:52
Adrian Fricker
Custom Computer Solutuion Ltd.
St. Albans, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00714731
Message ID:
00714736
Views:
14
>Hi
>
>I understand that the return value of SYS(2015) is based on system date& time.
>
>Is there away to recover the date & time form records created with this function?
>
>Thanks
>Adrian

Ed's right about his suspicions between machines + you might need some adjustments in code.
Remark : I don't know the original author of the code - this is a modified version :
Lparameters tcString, tnCentury, tnRollover
tnCentury=iif(type('tnCentury')#'N',INT(YEAR(DATE())/100)-1,tnCentury)
tnRollover=iif(type('tnRollover')#'N',50,tnRollover)
Local lnDay,lnYear, lnMillisecs, lnVal, ix, lnHoursMinsSecs, lnHours, lnMins, lnSecs

lnDay = 0
lnMillisecs = 0
For ix = 1 to 9
  tcString = SUBSTR(tcString,2)
  lnVal=ASC(tcString)-IIF(ISDIGIT(tcString),48,55)
  If ix < 4
    lnDay = lnDay + lnVal*36^(3-ix)
  Else
    lnMillisecs = lnMillisecs + lnVal*36^(9-ix)
  Endif
Endfor
*In the SYS(2015) world, every year has 367 days
lnYear=INT(lnDay/367)
*Add the right century to this year, because SYS(2015) only has years 0-99
*Strip the year off, so you only have the days since Jan 1st
lnYear=tnCentury*100+IIF(lnYear<tnRollover or lnYear=0,100,0)+lnYear
lnDay=lnDay%367
* lNDay must be substracted by 1 because lnDay=1 is Jan 1st, not day 0
lnHoursMinsSecs=int(lnMillisecs/1000)
lnHours=int(lnHoursMinsSecs/(60*60))
lnMins=int(lnHoursMinsSecs%(60*60)/60)
lnSecs=lnHoursMinsSecs%(60*60)%60
Return dtos(eval('{^'+str(lnYear,4)+'/1/1}')+lnDay-1)+;
  padl(lnHours,2,'0')+padl(lnMins,2,'0')+padl(lnSecs,2,'0')+padl(lnMillisecs%1000,3,'0')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform