>ODBC uses ODBC 'canonical format' for date&datetime. You could pass dtoc(dDateOrtDatetime,1). ie:
>
>ldStart = {^2003/04/01}
>ldEnd = {^2003/04/30} + 1 && Dealing with date part only - midnight
>
>trans(dtoc(ldStart,1)'@R 9999/99/99 99:99:99')
>trans(dtoc(ldEnd,1)'@R 9999/99/99 99:99:99')
>
>And SQL server also recognizes directly dtoc(,1) result as a date/time (YYYYMMDD and YYYYMMDDhhmmss).
>
>However with stringifying (a new word:) still you need to make sure you handle date or datetime format where time part is sensitive. Why don't you simply pass date or datetime parameters to your function. You could use that in both VFP and SQL server backends and don't bother with date/time settings at all. ie:
>
>ldStart = {^2003/04/01}
>ldEnd = {^2003/04/30 23:59:59}
>
>lcSQL = 'select * from News where AddDate between ?ldStart and ?ldEnd'
>
>&lcSQL && VFP
>SQLExec(lnHandle,lcSQL) && SQL server
>
>This works free from thinking you have date or datetime as field datatype or parameters datatype (handled implicitly converting a date to datetime pointing midnight).
>PS: I know you don't want to pass parameters or a parameters object but why not :)
Thanks for the additional input but I really need to stringifying in order to have that SQL syntax to be carried out to several methods.