thanks... but i'm looking for AsciiToDate function.
Because i compare two DatePtr format. for example, 12.12.2003 < 14.12.2003 your function returned month, day,year values. how do i create Date from (month, day,year)??? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Stephan Veigl Sent: Tuesday, January 27, 2004 3:31 PM To: Palm Developer Forum Subject: Re: ascii convert to date Hi > How do i convert ascii to date? > have a function? I've written a inverse function to DateToAscii() for my project => AsciiToData() hope this helps see also: http://cvs.sourceforge.net/viewcvs.py/aquapalm/divelog/divelog.c?rev=1.82&vi ew=auto by(e) Stephan /** * This routine reads the date from an ASCII string * * @param day - out: day * @param month - out: month * @param year - out: year * @param datetype - date format * @param str - date as string * * @return string read successfully * * @note <b> Revision History: </b> \n * * ***********************************************************************/ Boolean AsciiToDate(Int16 *month, Int16 *day, Int16 *year, DateFormatType datetype, char *str) { char *tmpstr,*datestr,sep[2],datetmp[15]; Boolean ret=false; *day=1; *month=1; *year=2000; if (!str) return false; StrNCopy(datetmp,str,14); datestr=datetmp; sep[0]=0x00; sep[1]=0x00; switch (datetype) { case dfDMYWithDots: case dfDMYWithDashes: case dfDMYWithSlashes: if (datetype==dfDMYWithDots) sep[0]='.'; if (datetype==dfDMYWithDashes) sep[0]='-'; if (datetype==dfDMYWithSlashes) sep[0]='/'; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *day=StrAToI(datestr); datestr=tmpstr+1; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *month=StrAToI(datestr); datestr=tmpstr+1; *year=StrAToI(datestr); ret=true; break; case dfMDYWithSlashes: sep[0]='/'; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *month=StrAToI(datestr); datestr=tmpstr+1; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *day=StrAToI(datestr); datestr=tmpstr+1; *year=StrAToI(datestr); ret=true; break; case dfYMDWithSlashes: case dfYMDWithDots: case dfYMDWithDashes: if (datetype==dfYMDWithDots) sep[0]='.'; if (datetype==dfYMDWithDashes) sep[0]='-'; if (datetype==dfYMDWithSlashes) sep[0]='/'; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *year=StrAToI(datestr); datestr=tmpstr+1; tmpstr=StrStr(datestr,sep); if (!tmpstr) return false; *tmpstr=0x00; *month=StrAToI(datestr); datestr=tmpstr+1; *day=StrAToI(datestr); ret=true; break; default: break; } // Y2K if (*year<100) *year+=1900; if (*year<1930) *year+=100; return ret; } -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08.01.2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08.01.2004 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
