Article View: borland.public.cppbuilder.database.ado
Article #1828Best way to set a date/time field
From: Steve Aletto
Date: Tue, 10 Feb 2004 16:25
Date: Tue, 10 Feb 2004 16:25
16 lines
1640 bytes
1640 bytes
Hi all,
I'd like to know what's the best way to set a date/time field in a database.
I thought the following was quite good (Q is a TADOQuery *):
Q->SQL->Add("UPDATE TableName SET FieldName=" + String(double(Now())));
But that's not true: with SQL server you should substract 2, furthermore
comma must be substituted with dot (it depends on the international settings
of the PC though) and maybe some other bugs are behind the corner. I found
many problems/differences handling the date/time field as a string, too.
So, I'm looking for a sure and standard (same for many databases) way to
achieve this simple job. Thanks for any hint.
Steve.
Technical Details
Message-ID:
<402905f6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx01.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,55d7527b38e6f972,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-02-10 08:39:45 PST Reply-To: "Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> From: "Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Best way to set a date/time field Date: Tue, 10 Feb 2004 17:25:47 +0100 Lines: 18 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 80.105.101.132 Message-ID: <402905f6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1076430326 80.105.101.132 (10 Feb 2004 08:25:26 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx01.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail