Normally I don't spoon feed but this code was easy to grab and I'm feeling
charitable.  If any one sees anything wrong w/ my code feel free to comment.

DateType ASCIIToDate(char*ConvertDate)
{
        DateType date;
        char DateString[11];
        StrCopy(DateString,ConvertDate);
        char * Slash;
        char*StrPtr=DateString;

        char*End=StrPtr+StrLen(StrPtr);

        Slash=StrChr(StrPtr,'/');
        if(Slash!=NULL&&(UInt32)Slash<(UInt32)End)
        {
                Slash[0]=0;//null byte
                date.month=StrAToI(StrPtr);

                StrPtr=Slash+1;//advance past the slash
                Slash=StrChr(StrPtr,'/');
                if(Slash!=NULL&&(UInt32)Slash<(UInt32)End)
                {
                        Slash[0]=0;
                        date.day=StrAToI(StrPtr);
                        StrPtr=Slash+1;
                        if(StrLen(StrPtr)>0)
                        {
                                date.year=StrAToI(StrPtr);
                                return date;
                        }
                }
        }
        MemSet(&date,0,sizeof(DateType));
        return date;
}

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:bounce-palm-dev-forum-46155@;news.palmos.com]On Behalf
> Of Dinesh
> Kumar
> Sent: Thursday, October 24, 2002 8:51 AM
> To: Palm Developer Forum
> Subject: String to DateTpe Conversion
>
>
> Hi ,
>   Can any one  tell me the code for converting a String to a
> DateType or any
> other Time Structure
>   I need it urgently,
>    thanx in advance ,
>        Dinesh Kumar.
>
>
> --
> 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/

Reply via email to