>if the date is of dd/mm/yy i 've to return dd/mm/yyyy
> (dd/mm/yy is only one format,and assuming i don't know the format )
>then how?
Rahd,
Foxpro (all versions including Foxbase) store date as YYYYMMDD in tables regardless of how you enter them. And as far as you work with date type then you need
no conversion for date math.
* dd/mm/yy format used
? {01/01/98}+3 && {04/01/1998}
* dd/mm/yyyy format used
? {01/01/1998}+3 && {04/01/1998}
* mm/dd/yyyy format used
? {01/01/98}+3 && {01/04/1998}
* yyyy/mm/dd format used
? {1998/01/01}+3 && {1998/01/04}
The result is same Jan 4th, 1998. But anyway if you want to use conversion for some other reason :
lnOldFormat = set("date",1)
lcOldCentury = set("century")
set century on
set date to dmy
set century &lcOldCentury
do case
case lnOldFormat = 0
set date to MDY
case lnOldFormat = 1
set date to DMY
case lnOldFormat = 2
set date to YMD
endcase
Cetin