Article View: borland.public.vdbase.data.sql
Article #163Re: Date field in sql builder
From: Steve Koterski
Date: Fri, 05 Mar 1999 00:00
Date: Fri, 05 Mar 1999 00:00
56 lines
3170 bytes
3170 bytes
On Fri, 05 Mar 1999 21:30:21 GMT, skoterski@NOSPAMinprise.com (Steve Koterski) wrote: >On Thu, 4 Mar 1999 10:24:06 +0100, teamb@opto-pps.com (Romain Strieff >[TeamB]) wrote: > >[...] > >>But only if you use the slash as separator, if you use the dot, it works. >>It seems to think it's US dates only when it sees the "/" Okay. So here is the rewrite of the date topic for the online help. Does this appear to explain the situation to everyone's satisfaction? Date formats ============ There are two acceptable formats for the date parts of DATE and TIMESTAMP literals in local SQL statements: the US date format and the European date format. Which one of the two you use is predicated on the Windows configuration settings for Date Separator and Short Date Style. If the Date Separator is a slash (/) and Short Date Style puts the month before the day (such as MM-dd-yy), the date must be in a US date format, MM/DD/YY or MM/DD/YYYY. If the Date Separator is a period (.) and Short Date Style puts the day before the month (such as dd.MM.yy), the date must be in a European date format, DD.MM.YY or DD.MM.YYYY. A combination of Short Date Style of month before day and a Date Separator of anything but a period is not supported in local SQL. DATE and TIMESTAMP values passed to an SQL statement via parameters and the values in columns are unaffected by these restrictions on format. Only literal values are affected. To prevent date literals from being mistaken by the SQL parser for arithmetic calculations, enclose them in quotation marks. This keeps 1/23/1998 from being mistaken for 1 divided by 23 divided by 1998. Example of a date literal in a US format: SELECT * FROM orders WHERE (saledate <= "1/23/1998") Example of the same date literal in a European format: SELECT * FROM orders WHERE (saledate <= "23.1.1998") Leading zeros for the month and day fields are optional. If the century is not specified for the year in a date value, the BDE settings FOURDIGITYEAR and YEARBIASED control the century of the date. ////////////////////////////////////////////////////////////////////////// Steve Koterski "My problem lies in reconciling my gross Technical Publications habits with my net income." INPRISE Corporation -- Errol Flynn (1909-1959) http://www.borland.com/delphi
Technical Details
Message-ID:
<36e05794.2564006@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7bk1bs$2i77@forums.borland.com> <36ddce30.1329713@forums.borland.com> <36e4e115.7047839@forums.inprise.com> <MPG.114868a19e128ae3989fa1@forums.inprise.com> <36e74b65.17766972@forums.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,9c0ce2ccf9b5c6e5 X-Google-Attributes: gidff5a1,public From: skoterski@NOSPAMinprise.com (Steve Koterski) Subject: Re: Date field in sql builder Date: 1999/03/05 Message-ID: <36e05794.2564006@forums.inprise.com> X-Deja-AN: 451716394 Content-Transfer-Encoding: 7bit References: <7bk1bs$2i77@forums.borland.com> <36ddce30.1329713@forums.borland.com> <36e4e115.7047839@forums.inprise.com> <MPG.114868a19e128ae3989fa1@forums.inprise.com> <36e74b65.17766972@forums.inprise.com> Content-Type: text/plain; charset=us-ascii Organization: INPRISE Corporation, Technical Publications Mime-Version: 1.0 Reply-To: skoterski@NOSPAMinprise.com Newsgroups: borland.public.vdbase.data.sql