I think the documentation is wrong I had to use 1970 for the base year in
order for it to work with my Palm Reader/Writer classes. I remember reading
about this before but can't remember were.
Here's are my conversion routines in C#
static public long Date2Seconds(DateTime dt)
{
DateTime startDate = new DateTime(1970,1,1,0,0,0);
int totalDays;
long totalSeconds;
// get total day count
totalDays = dt.DayOfYear-1; // number of days in current year
if (dt.Year != startDate.Year)
{
for (int i = startDate.Year;i < dt.Year;i++)
{
if (DateTime.IsLeapYear(i))
totalDays += 366;
else
totalDays += 365;
}
}
totalSeconds = totalDays*86400; // multiply by the number of seconds in a
day
totalSeconds += dt.Hour*3600; // multiply by the number of seconds in an
hour
totalSeconds += dt.Minute*60; // multiply by the number of seconds in a
Minute
totalSeconds += dt.Second; // add remaining seconds
return totalSeconds;
}
static public DateTime Seconds2Date(long totalSeconds)
{
DateTime resultDate = new DateTime(1970,1,1,0,0,0);
resultDate.AddSeconds(totalSeconds);
return resultDate;
}
"Henk Jonas" <[EMAIL PROTECTED]> wrote in message
news:111614@palm-dev-forum...
>
> Hi Adrian,
>
> thank you for the offer, I will do, I'm sure :-)
>
> "But when I approximate 100 years then I get 36524 days * 24 h/day * 60
> minutes/hour * 60 seconds/minute which is 3155673600 or in hexadecimal
> 0xbc17c200."
>
> So, you mean 0xbc17c200 is the right date for 1.1.2004? And 0x3e3bcffb
> is wrong, because it is something 1937?
>
> But I have two palms with two user names andi n both home directories in
> the backup folder there are a lot of pdb's, coming directly from the
> handhelds. And I just checked two of them, saved_preferences.pdb and
> connectiondb.pdb and both have the date of 0x3d4151d9 and 0x3e3bcb2a.
> Are the dates wrong in both databases? Or is just the assumption wrong
> that the dates are the seconds since 1.1.1904 or do I maybe calculate
> garbage?
>
> Thank you,
> Henk
>
> Adrian Nicolaiev wrote:
> > Henk,
> >
> >
> >>can you explain? I think I miss something here...
> >
> >
> > There is another possibility :-)
> > Just in time...
> >
> > Maybe, the software you are using to create your pdb isn't honoring
dates
> > (year)...
> > If you wish, you may send me an empty pdb and I will check it for you.
> >
> > Best wishes,
> >
> > Adrian Nicolaiev
> > http://www.niconnect.com
> >
> >
> >
> >
>
>
> --
> -------------------------------------------------------------------------
> [EMAIL PROTECTED] www.metaviewsoft.de
>
> <A HREF="http://www.handango.com/PlatformTopSoftware.jsp?authorId=95946">
> <IMG SRC="http://user.cs.tu-berlin.de/~jonash/werbung_palmos.jpg"></A>
> -------------------------------------------------------------------------
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/