Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Coded Date & Time for report comparision validity
Message
 
To
12/11/2002 14:31:21
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00720958
Message ID:
00721987
Views:
7
Here it is. Thanks for all your help
*-* m.zdate = DATE()
*-* m.zyear = YEAR(m.zdate) % 100
*-* m.zmonth = MONTH(m.zdate)
*-* m.zday = DAY(m.zdate)
*-*
*-* m.ztime = TIME()
*-* m.zhour = VAL(LEFT(m.ztime, 2))
*-* m.zminute = VAL(SUBSTR(m.ztime, 4, 2))
*-* m.zsecond = VAL(SUBSTR(m.ztime, 7, 2))
*-*
*-* m.zprecision = 3 & 1=rounded to 1 min, 2 to 2 min, so on
*-*
*-*
*-* m.zcoded = m.zyear
*-* m.zcoded = m.zcoded * 12
*-*
*-* m.zcoded = m.zcoded + m.zmonth
*-* m.zcoded = m.zcoded * 24
*-*
*-* m.zcoded = m.zcoded + m.zday
*-* m.zcoded = m.zcoded * 48
*-*
*-* m.zcoded = m.zcoded + m.zhour
*-* m.zcoded = m.zcoded * 96
*-*
*-* m.zcoded = m.zcoded + INT(m.zminute / m.zprecision)
*-*
*-* *** decode the above
*-* m.zdecoded = m.zcoded
*-*
*-* m.zminute = m.zdecoded % 96
*-* m.zdecoded = (m.zdecoded - m.zminute) / 96
*-*
*-* *** get back the precision but only after deducting above
*-* m.zminute = m.zminute * m.zprecision
*-*
*-* m.zhour = m.zdecoded % 48
*-* m.zdecoded = (m.zdecoded - m.zhour) / 48
*-*
*-* m.zday = m.zdecoded % 24
*-* m.zdecoded = (m.zdecoded - m.zday) / 24
*-*
*-* m.zmonth = m.zdecoded % 12
*-* m.zdecoded = (m.zdecoded - m.zmonth) / 12
*-*
*-* m.zyear = m.zdecoded

>>Thanks Hilmar I have tried it and it works. I also tried to reduce the precision to 5 and 2 mins resp. (the_whole_calc) / (60 *5) I got a 6 digit number. I have tried to decode your original calc and was successful only to the seconds part. I tried reverse calc but my brain gaveway under the strain <g> I this calc reversable?
>
>That's the idea, of course. But when I try it, I see the constants need adjustment - you need to adjust them to the next, not the previous, time conversion unit. Let's try the first part of the calculation.
>
>(Year * 12 + Month) * 24 + Day
>
>Year: 2002.
>Month: 11.
>Day: 12.
>
>2002 * 12 = 24024
>24024 + 11 = 24035
>24035 * 24 = 576840
>576840 + 12 = 576852
>
>Now, the reverse can be done in several ways, I believe.
>
>576852 / 24 = 24035 (integer part); the remainder (use subtraction, or 576852 % 24) is 12.
>
>24035 / 12 = 2002; the remainder is 11
>
>Is it clear now?
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform