>>Hi all,
>>
>>I have a character field that is a date in mmddyyyy format. I need to sort the file by this serv_date field.
>
>That's a very bad format for sorting. I'm amazed at Americans who don't use the American standard date format (Set Date ANSI and see what I mean) :)
>
>>There is a DTOS (Date To String) command, but no inverse STOD (String To Date). Currently I am
>
>Here's the STOD function I wrote because of a similar dispute here, years ago:
>
>
>* v1.0 16.10.97, povodom jedne rasprave na UTu - regarding a dispute on UT
>*-
>Lpara dtos_lc
>local setd_lc, date_ld
>setd_lc=set("date")
>set date ymd
>date_ld=ctod(transform(dtos_lc,"@R 9999.99.99"))
>set date (setd_lc)
>Return date_ld
>
>Note that this works for results from dtos(), which formats the date into yyyymmdd (i.e. sortable) format. You may use subs(datefield,5,4)+left(datefield,4) as your index expression to avoid this whole problem, as you wouldn't have to convert to dates and back in that case.
I agree totally on bad date format for sorting, Dragan. Too bad I can't control what the client sends me. :-)
I will have to spend some time analyzing your snippet. I'm slow but sure.
PS I'm not sure what language the article title is in. Looks like one of the Slavics, but I'm not good in any of them. Which reminds me:
What do you call a person that speaks 2 languages? Bilingual.
What do you call a person that speaks 3 languages? Trilingual.
What do you call a person that speaks 1 language? American.
Pete
Peter Adams
FoxPro Programmer
Compu-Mail
Heisenberg was probably right...