DateType puts all of the date information in a 16-bit unsigned integer.
Also, it only contains year, month, and day.  DateTimeType breaks the hour,
minute, second, etc. into individual 16-bit integers (more memory, but
"easier" to deal with).

To see the years since 1904 from a DataType structure, you should use years
= date.year, month = date.month, and day = date.day.

Regards,

Steve

-----Original Message-----
From: Mark W. Alme [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 21, 2000 5:34 PM
To: Palm Developer Forum
Subject: DateTimeType vs. DateType


Hello:

        I was having trouble using DateTypes:
<code>
        ULong seconds = TimGetSeconds();

        DateType date;
        DateSecondsToDate(TimGetSeconds(), &date);
        // date now 4 years prior to current date

        ULong addSeconds = (4 * 365.25 * 24 * 60 * 60); // add four years
        seconds += addSeconds;
        DateSecondsToDate(seconds, &date);
        // date now current day of the year 100 (when current date in 2000)
        // is this some sort of y2k problem?

        // using DateTimeType seems to fix the problem
        DateTimeType timer;

        TimSecondsToDateTime(TimGetSeconds(), &timer);
         // timer now has correct current date.

</code>

        Does anyone know if there is a know advantage for using 
DateTimeTypes versus using DateTypes?  I saw a post on the archives 
where a developer wondered if DateTypes even existed in the api. 
Advice welcome.

Mark


-- 

Mark W. Alme
Analyst
Alme & Associates

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to