I must be still missing something, and i greatly appreciate the feedback. To make it simple, i just want to display the value in the record->time field.
MemHandle handle;
char* ptr;
DateTimeType dateTime;
Char *pTimeString = MemPtrNew(9);
handle = DmQueryRecord(dbP,index);
//lock this record so we can access it;
ptr = MemHandleLock(handle);


//Unpack the recor
record ->flags = *(UInt16*)ptr;
ptr += sizeof(record->flags);
DateToInt(record->date) =*(UInt16*)ptr;
ptr += sizeof(record->date);
TimeToInt(record->time) = *(UInt16*)ptr;
//how do i display this record->time field in a string, here's my attempt
TimSecondsToDateTime (TimeToInt(record->time), &dateTime);
TimeToAscii ( (UInt8)(dateTime.hour), (UInt8)(dateTime.minute),tfColonAMPM, pTimeString);
FrmCustomAlert(custom,pTimeString,"",""); //gives me 12:00am regardless of what the field value is


ptr += sizeof(record->time);
record ->duration =*(UInt32*)ptr;
ptr+=sizeof(record->duration);
record->name = ptr;
ptr+=StrLen(ptr)+1;

From: "A.Kazantsev (psn)" Reply-To: "Palm Developer Forum" To: "Palm Developer Forum" Subject: Re: Converting Date to Text Field Date: Tue, 29 Jun 2004 11:05:39 +0400

You may try the following code. void TimeToString (UInt32 numericDateTime, char* strDateTime) { DateTimeType dateTime;

Char *pDateString = MemPtrNew(9); Char *pTimeString = MemPtrNew(9); TimSecondsToDateTime (numericDateTime, &dateTime); DateToAscii (dateTime.month, dateTime.day, dateTime.year, dfDMYWithDashes, pDateString); TimeToAscii ( (UInt8)(dateTime.hour), (UInt8)(dateTime.minute), tfColon24h, pTimeString); StrCopy(strDateTime, pDateString); StrCat(strDateTime, " "); StrCat(strDateTime, pTimeString);

MemPtrFree (pDateString); MemPtrFree (pTimeString); pDateString = NULL; pTimeString = NULL; }


----- Original Message ----- From: "vanitha s" To: "Palm Developer Forum" Sent: Tuesday, June 29, 2004 9:51 AM Subject: Re: Converting Date to Text Field



> hi! > > try out DateToAscii().check out this website > http://www.fuw.edu.pl/~michalj/palmos/DateAndTimeManager.html#925005 > regards > vanitha > > > > --- Matthew Horvat wrote: > > I have the following struct and populate it with the > > following code. My > > question is how do i reference either the date or > > time to get it into a text > > control. The DateToInt is throwing me off??? > > > > typedef struct > > { > > UInt16 flags; > > DateType date; > > TimeType time; > > }DBTele; > > > > //Unpack the record > > record ->flags = *(UInt16*)ptr; > > ptr += sizeof(record->flags); > > > > DateToInt(record->date) =*(UInt16*)ptr; > > ptr += sizeof(record->date); > > > > TimeToInt(record->time) = *(UInt16*)ptr; > > ptr += sizeof(record->time); > > > > If you need additional info, please let me know so i > > can resolve this. > > > > > _________________________________________________________________ > > FREE pop-up blocking with the new MSN Toolbar - get > > it now! > > > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ > > > > > > -- > > For information on using the Palm Developer Forums, > > or to unsubscribe, please see > > http://www.palmos.com/dev/support/forums/ > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Helps protect you from nasty viruses. > http://promotions.yahoo.com/new_mail > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ >




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

_________________________________________________________________
From �will you?� to �I do,� MSN Life Events is your resource for Getting
Married. http://lifeevents.msn.com/category.aspx?cid=married


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

Reply via email to