Message from discussion
FoxPro Date Processing
Path: g2news2.google.com!postnews.google.com!j55g2000cwa.googlegroups.com!not-for-mail
From: brendan.mcken...@gmail.com
Newsgroups: microsoft.public.dotnet.framework
Subject: FoxPro Date Processing
Followup-To: microsoft.public.dotnet.framework
Date: 18 May 2006 23:24:59 -0700
Organization: http://groups.google.com
Lines: 34
Message-ID: <1148019899.674915.149110@j55g2000cwa.googlegroups.com>
NNTP-Posting-Host: 203.166.126.2
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1148019903 22304 127.0.0.1 (19 May 2006 06:25:03 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 19 May 2006 06:25:03 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.0 LPAUWC0001 (NetCache NetApp/5.6.2D11)
Complaints-To: groups-abuse@google.com
Injection-Info: j55g2000cwa.googlegroups.com; posting-host=203.166.126.2;
posting-account=hzNbVw0AAAAGsqmhUGkX4L1CU-cjv8PI
Hello,
I am writing a class to process FoxPro .dbf files, all has been going
well, but I have recently hit a snag. I'm trying to convert FoxPro's
DateTime field (T) to a System.DateTime. FoxPro's field is 2 32bit
integers: one stores the date, the other stores the time, stored in
reverse byte order. (2f 4a 12 9a== 9a 12 4a 2f)
Easy... here's the hard part. The date integer stores the number of
days from 1/1/4712BC (yes... BC). The time integer stores the number
of milliseconds from 00:00:00.
Processing the time was easy ( DateTime.AddMilliseconds() ).
Processing the date, is not.
Is there anyone who can lend a hand and help me process this date?
The date integer: 2453809 should become 20/04/2006
My current process is:
DateTime dt = new DateTime(1, 1, 1);
dt = dt.AddDays(days);
dt = dt.AddYears(-4713);
This results in a DateTime which is 2 days off, and I'm afraid it may
result in more problems due to leap years with other dates.
Can anyone help me out with this?
Thanks!
Brendan