Nov 27, 2002 #1 mm0000 IS-IT--Management May 19, 2002 295 IN How can I convert a character field with dates in the format 'DD-MON-YY' to a valid Foxpro date.
Nov 27, 2002 #2 Mike Gagnon Programmer Apr 6, 2002 8,067 CA mm0000 It depends how they are stored in the character field. Mike Gagnon If you want to get the best response to a question, please check out FAQ184-2483 first or check this link http://www.tuxedo.org/~esr/faqs/smart-questions.html Upvote 0 Downvote
mm0000 It depends how they are stored in the character field. Mike Gagnon If you want to get the best response to a question, please check out FAQ184-2483 first or check this link http://www.tuxedo.org/~esr/faqs/smart-questions.html
Nov 27, 2002 1 #3 Neil Toulouse Programmer Mar 18, 2002 882 GB Something like this procedure? : LOCAL ldDate ldDate = ConvertDate('12-APR-02') ? DTOC(ldDate) PROCEDURE ConvertDate LPARAMETER tcDate LOCAL lcMonTxt, lcMonNum, lcDay, lcYear lcDay = SUBSTR(ALLTRIM(tcDate), 1, 2) lcMon = SUBSTR(ALLTRIM(tcDate), 4, 3) lcYear = SUBSTR(ALLTRIM(tcDate), 8, 2) DO CASE CASE lcMon = 'JAN' lcMon = '01' CASE lcMon = 'FEB' lcMon = '02' CASE lcMon = 'MAR' lcMon = '03' CASE lcMon = 'APR' lcMon = '04' CASE lcMon = 'MAY' lcMon = '05' CASE lcMon = 'JUN' lcMon = '06' CASE lcMon = 'JUL' lcMon = '07' CASE lcMon = 'AUG' lcMon = '08' CASE lcMon = 'SEP' lcMon = '09' CASE lcMon = 'OCT' lcMon = '10' CASE lcMon = 'NOV' lcMon = '11' CASE lcMon = 'DEC' lcMon = '12' ENDCASE lcNewDate = ALLTRIM(lcDay) + '/' + ALLTRIM(lcMon) + '/' + ALLTRIM(lcYear) ldDate = CTOD(lcNewDate) RETURN ldDate ENDPROC "I love work. I can sit and stare at it for hours..." Upvote 0 Downvote
Something like this procedure? : LOCAL ldDate ldDate = ConvertDate('12-APR-02') ? DTOC(ldDate) PROCEDURE ConvertDate LPARAMETER tcDate LOCAL lcMonTxt, lcMonNum, lcDay, lcYear lcDay = SUBSTR(ALLTRIM(tcDate), 1, 2) lcMon = SUBSTR(ALLTRIM(tcDate), 4, 3) lcYear = SUBSTR(ALLTRIM(tcDate), 8, 2) DO CASE CASE lcMon = 'JAN' lcMon = '01' CASE lcMon = 'FEB' lcMon = '02' CASE lcMon = 'MAR' lcMon = '03' CASE lcMon = 'APR' lcMon = '04' CASE lcMon = 'MAY' lcMon = '05' CASE lcMon = 'JUN' lcMon = '06' CASE lcMon = 'JUL' lcMon = '07' CASE lcMon = 'AUG' lcMon = '08' CASE lcMon = 'SEP' lcMon = '09' CASE lcMon = 'OCT' lcMon = '10' CASE lcMon = 'NOV' lcMon = '11' CASE lcMon = 'DEC' lcMon = '12' ENDCASE lcNewDate = ALLTRIM(lcDay) + '/' + ALLTRIM(lcMon) + '/' + ALLTRIM(lcYear) ldDate = CTOD(lcNewDate) RETURN ldDate ENDPROC "I love work. I can sit and stare at it for hours..."
Nov 27, 2002 #4 Mike Gagnon Programmer Apr 6, 2002 8,067 CA FatSlug ldDate = ConvertDate('12-APR-02') I guess we can presume the date is store in that fashion in the character field Mike Gagnon If you want to get the best response to a question, please check out FAQ184-2483 first or check this link http://www.tuxedo.org/~esr/faqs/smart-questions.html Upvote 0 Downvote
FatSlug ldDate = ConvertDate('12-APR-02') I guess we can presume the date is store in that fashion in the character field Mike Gagnon If you want to get the best response to a question, please check out FAQ184-2483 first or check this link http://www.tuxedo.org/~esr/faqs/smart-questions.html
Nov 27, 2002 #5 Neil Toulouse Programmer Mar 18, 2002 882 GB Hi Mike! Yes, I assumed that from the title of the thread "I love work. I can sit and stare at it for hours..." Upvote 0 Downvote
Hi Mike! Yes, I assumed that from the title of the thread "I love work. I can sit and stare at it for hours..."
Nov 27, 2002 Thread starter #6 mm0000 IS-IT--Management May 19, 2002 295 IN FatSlug, It worked great. Upvote 0 Downvote