David Leland <[EMAIL PROTECTED]> wrote in message
news:50246@palm-dev-forum...
>
> I'm looking for a routine that either retrieves the day of the year from a
> Palm date or converts a Palm date to a Julian date.  I've looked thru the
> archives, thru the DateBook sample and thru all the Palm code sites I have
> bookmarked but haven't come up with anything.  Anyone have an idea of
where
> I could find such a routine?

Try something like this to get the day of the year.  *Warning* I've not
compiled nor run the following.  You'll also need to check for off-by-one
(that is, make sure that Jan 1 is 1 and not 0).

---

UInt32 Seconds;
DateType Date;
UInt32 NumDays;

// Get number of days since January 1, 1904

Seconds = TimGetSeconds();
TimSecondsToDateTime(Seconds, Today);
NumDays = DateToDays(Date);

// Subtract out days before the first of this year

Date.month = 1;
Date.day = 1;
NumDays = NumDays - DateToDays(Date) + 1;

---

Or, use DaysInMonth() and a loop to increment over each complete month,
summing the number of days.

HTH

Jeff



-- 
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