The way you are doing it looks fine.
True that the year is relative, but it
shouldn't change day and month.


I am not sure whether it will help you
but... I prefer keeping time in seconds
in the data base. Unless you need some
tricky manipulations, you can have a
function to convert seconds to a readable
format just before output. This is why
I don't have any problem with that.

Michael


-----Original Message-----
From: Todd C. Johnson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 12 December 2001 6:41 AM
To: Palm Developer Forum
Subject: Date trouble


I am trying to create a new record with default date and start time. I am
using the structure and code below. Now.day, now.year, now.month are
correct. But when move them to the record structure I get different values.
Now.day should equal record.date.day, but they are not.

What I am overlooking?

Thanks,

Todd

Here is my record format

    // Format for record
    typedef struct
    {
      DateType  date;   // Date of service perid
      DateTimeType start;   // Start of service period
      DateTimeType end;   // End of service period
      TimeType  totalTime;  // Time
    } ServDBRecord;

Here is the code in question:
     UInt16   index;
     ServDBRecord record;
     DateTimeType now;

     // Get current date for new Service Period
     TimSecondsToDateTime(TimGetSeconds(), &now);

     record.date.day = now.day;                        //now.day=11,
record.date.day = 20
     record.date.month = now.month;                 //now.month=12,
record.date.month = 7
     record.date.year = now.year;                        //now.month=2001,
record.date.year = 11



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