Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper syntax for universal date
Message
De
10/04/2003 09:27:03
 
 
À
10/04/2003 09:06:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00775886
Message ID:
00776001
Vues:
25
>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.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform