Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Date to SQL DateTime
Message
From
19/03/2007 14:14:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01205160
Message ID:
01205667
Views:
18
>Hi Sergey.. I have the date working now.
>
>I used "'" + Dtos(MyDate) + "'"
>So a combination of Dtos and single quotes seemd to work.

And it will work with default settings for USA - i.e. set date American (not ANSI, which is supposed to be "standard American" :), and the corresponding setting in your ODBC and SQL. Once one of these gets set differently, you'll end up with the end-of-XIX-century type of date, or just null, in your SQL-side datetime fields.

For a more general approach, I use this:
#define s_quote ["]
tcValue=C_SQUOTE+transform(ttoc(tuvalue,1), "@R 9999-99-99 99:99:99")+C_SQUOTE
and that's the value that gets inserted for a datetime value. For just dates, omit the "99:99:99" part. This format is not ambiguous and will pass unscathed through ODBC.

For MYSQL it's even simpler: use ttoc(tuValue, 1).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform