CREATE CURSOR curMyDates( Old_Date C(10), New_Date C(8) )
INSERT INTO curMyDates ( Old_Date) VALUES ( '11/09/1970' )
INSERT INTO curMyDates ( Old_Date) VALUES ( '11/09/70' )
INSERT INTO curMyDates ( Old_Date) VALUES ( '11/09/' )
INSERT INTO curMyDates ( Old_Date) VALUES ( '11/09' )
SELECT curMyDates
SCAN
REPLACE New_Date WITH YYYYMMDD(Old_Date) IN curMyDates
SELECT curMyDates
ENDSCAN
GO TOP
BROWSE
***********************************************
PROCEDURE YYYYMMDD
LPARAMETERS tcDate
LOCAL lcRetVal
DO CASE
CASE LEN(ALLTRIM(tcDate)) = 10
lcRetVal = DTOS(CTOD(tcDate))
CASE LEN(ALLTRIM(tcDate)) = 8
lcRetVal = "19" + SUBSTR(tcDate,7,2) + SUBSTR(tcDate,4,2) + SUBSTR(tcDate, 1, 2)
*** Note four zeros instead of spaces as I couldn't get them to stay right justified
*** in the table!
CASE LEN(ALLTRIM(tcDate)) = 5 OR LEN(ALLTRIM(tcDate)) = 6
lcRetVal = '0000' + SUBSTR(tcDate,4,2) + SUBSTR(tcDate, 1, 2)
OTHERWISE
lcRetVal = ""
ENDCASE
RETURN lcRetVal
ENDPROC