Converting Binary Dates
Keywords: Converting binary dates
Question:
I have a date (2000:10:17) stored as a binary value in the Registry, where it appears as 32 30 30 30 3a 31 30
3a 31 37 00. I know how to extract it, but how can I convert the date back to human-readable format?
Answer:
So how do you extract it. What function do you use. Assuming you get back
32 30 30 30 3a 31 30 3a 31 37 00
it might be:
a="32 30 30 30 3a 31 30 3a 31 37 00"
cvt="123456789abcdef"
count=Strlen(a) -2
a=Strlower(a)
for xx=1 to count by 3
b1=Strindex(cvt,Strsub(a,xx,1),0,@fwdscan)
b2=Strindex(cvt,Strsub(a,xx+1,1),0,@fwdscan)
byte=b1*16+b2
char=Num2Char(byte)
if xx==1 then datestring=char
else datestring=Strcat(datestring,char)
next
Message(a,datestring)
Article ID: W14656
Filename: Converting Binary Dates.txt