>>>>>>Nadya,
>>>>>>
>>>>>>Try this instead
>>>>>>
>>>>>>
>>>>>>lcDate=dtoc(date()-10,1)
>>>>>>? between(lcDate,"20001201","20010129")
>>>>>>
>>>>>
>>>>>Thanks to everyone, who replied.
>>>>>
>>>>>I solved the problem by:
>>>>>between(ctod(CharField),date1,date2)
>>>>>Works fine.
>>>>
>>>>Works fine, but it will give you problems with ambiguous dates if SET STRICTDATE is not 0.
>>>
>>>It's an old legacy code in FPD2.6 Really, I hate to work with FPD after years of working in VFP. Anyway, it works fine in my tests and hopefully, I would not bother with this crap again :)
>>
>>Missed the 2.6 part. DTOS() woould still be better IMO, and the code will still work correctly if it ever gets brought up to VFP.
>1) It would not :)
Sure it would, once you're dates were translated from character that is. ;)
>2) Secondly, what DTOS()?
> I have char field in a table called Date
> User inputs Date1 and Date2 in a Screen in date format.
>
> So, the simplest where clause would be: between(ctod(date),date1,date2)
Works as long the date format matches (possibly not a problem for you). You may also have Y2K issues if the dates don't have 4-digit years stored in the character field.
DTOS() was available in 2.6 (along with DTOC(date,1)), both create a character string from a date type field in the form YYYYMMDD, no matter what the current SET DATE TO format is.