foxpro 2.6 always thinks a 8 character long date is in 20th century, ie it sees {dd/mm/xx} as {dd/mm/19xx}
I use this function
FUNCTION choosecent
PARAMETERS m.prdate, m.prnoyears
IF m.prdate={ / / }
RETURN m.prdate
ENDIF
IF PARAMETERS() < 2
m.prnoyears = 90
ENDIF
m.newdate=m.prdate
m.pryeardate=YEAR(DATE())
DO WHILE m.pryeardate-YEAR(m.newdate) >m.prnoyears
m.newdate=GOMONTH(m.newdate,1200)
ENDDO
DO WHILE YEAR(m.newdate)-m.pryeardate >100-m.prnoyears
m.newdate=GOMONTH(m.newdate,-1200)
ENDDO
RETURN m.newdate
Use it with two parameters (date,Z) and it will see if the date is more than Z years ago if it is, it goes forward to the correct century. (Z is set to default to 90)
Simon
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only