🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
7 messages
7 total messages Started by Edward Diener Sun, 01 Dec 2002 19:34
Converting DATE. TIME, and TIMESTAMP values for SQL
#11259
Author: Edward Diener
Date: Sun, 01 Dec 2002 19:34
11 lines
1439 bytes
How does one convert:

1) A 32-bit integer date value to an acceptable SQL value for a DATE column,
or does a 32-bit numeric value suffice ?
2) A 32-bit integer time value to an acceptable SQL value for a TIME column,
or does a 32-bit numeric value suffice ?
3) A 64-bit large integer value to an acceptable SQL value for a TIMESTAMP
column, or does the 64 bit numeric value suffice ?

Essentially what are the acceptable values for inserting or updating a DATE,
TIME, or TIMESTAMP value in an SQL statement in Interbase ?
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11260
Author: Arno Brinkman
Date: Sun, 01 Dec 2002 20:27
27 lines
1866 bytes
Hi,

> How does one convert:
>
> 1) A 32-bit integer date value to an acceptable SQL value for a DATE
column,
> or does a 32-bit numeric value suffice ?
> 2) A 32-bit integer time value to an acceptable SQL value for a TIME
column,
> or does a 32-bit numeric value suffice ?
> 3) A 64-bit large integer value to an acceptable SQL value for a TIMESTAMP
> column, or does the 64 bit numeric value suffice ?
>
> Essentially what are the acceptable values for inserting or updating a
DATE,
> TIME, or TIMESTAMP value in an SQL statement in Interbase ?

I can't find any specific format's in the standard-SQL language, but as far
as i know the most db-engines supports these formats (and so does Interbase)
:

DATE : YY-MM-DD
TIME : HH:NN:SS
TIMESTAMP : YY-MM-DD HH:NN:SS

Regards,
Arno
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11262
Author: Edward Diener
Date: Sun, 01 Dec 2002 22:27
36 lines
2353 bytes
"Arno Brinkman" <bnewsgroups @ abvisie.nl> wrote in message
news:3dea6f7e@newsgroups.borland.com...
> Hi,
>
> > How does one convert:
> >
> > 1) A 32-bit integer date value to an acceptable SQL value for a DATE
> column,
> > or does a 32-bit numeric value suffice ?
> > 2) A 32-bit integer time value to an acceptable SQL value for a TIME
> column,
> > or does a 32-bit numeric value suffice ?
> > 3) A 64-bit large integer value to an acceptable SQL value for a
TIMESTAMP
> > column, or does the 64 bit numeric value suffice ?
> >
> > Essentially what are the acceptable values for inserting or updating a
> DATE,
> > TIME, or TIMESTAMP value in an SQL statement in Interbase ?
>
> I can't find any specific format's in the standard-SQL language, but as
far
> as i know the most db-engines supports these formats (and so does
Interbase)
> :
>
> DATE : YY-MM-DD
> TIME : HH:NN:SS
> TIMESTAMP : YY-MM-DD HH:NN:SS

One of the problems is that sequence, at least as far as the date value, is
concerned, is locale dependent. In the US the dates are MM-DD-YY. So how
does one know which format to use ? I have searched for the SQL format for
DATE, TIME, and TIMESTAMP for Interbase in the docs to no avail. But this
seems par for the Interbase docs, which are terrible. No wonder Borland has
had such a hard time selling Interbase to customers.
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11264
Author: Arno Brinkman
Date: Sun, 01 Dec 2002 23:16
25 lines
1927 bytes
Hi,

> > DATE : YY-MM-DD
> > TIME : HH:NN:SS
> > TIMESTAMP : YY-MM-DD HH:NN:SS
>
> One of the problems is that sequence, at least as far as the date value,
is
> concerned, is locale dependent. In the US the dates are MM-DD-YY. So how
> does one know which format to use ? I have searched for the SQL format for
> DATE, TIME, and TIMESTAMP for Interbase in the docs to no avail. But this
> seems par for the Interbase docs, which are terrible. No wonder Borland
has
> had such a hard time selling Interbase to customers.

YY-MM-DD (much better, but i forgot to say is YYYY-MM-DD) is everywhere
excepted and has nothing to do with your locale settings.
DD-MM-YY or MM-DD-YY that's format that's depending on your locale, but most
only at the client site.

This (YYYY-MM-DD) is also the format you can find in the EmbedSQL guide from
Interbase.

Regards,
Arno Brinkman
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11266
Author: Wayne Niddery [TeamB]
Date: Mon, 02 Dec 2002 00:12
24 lines
1988 bytes
"Edward Diener" <eddielee@tropicsoft.com> wrote in message
news:3dea6388$1@newsgroups.borland.com...
> How does one convert:
>
> 1) A 32-bit integer date value to an acceptable SQL value for a DATE
column,
> or does a 32-bit numeric value suffice ?
> 2) A 32-bit integer time value to an acceptable SQL value for a TIME
column,
> or does a 32-bit numeric value suffice ?
> 3) A 64-bit large integer value to an acceptable SQL value for a TIMESTAMP
> column, or does the 64 bit numeric value suffice ?

It is impossible to answer this without knowing what the base and format of
these 32 / 64 bit values are. Is the 32 bit date a number of days? If so
what date does a value of 0 equal? Is the Time value a number of seconds,
milliseconds, ...?


--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
It used to be that other people's achievements were considered an
inspiration, not a grievance.
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11267
Author: Wayne Niddery [TeamB]
Date: Mon, 02 Dec 2002 00:23
45 lines
2554 bytes
"Edward Diener" <eddielee@tropicsoft.com> wrote in message
news:3dea8c42@newsgroups.borland.com...
>
> One of the problems is that sequence, at least as far as the date value,
is
> concerned, is locale dependent. In the US the dates are MM-DD-YY. So how
> does one know which format to use ?

Interbase always accepts the same set of formats no matter what anyone's
local settings may be.

I have searched for the SQL format for
> DATE, TIME, and TIMESTAMP for Interbase in the docs to no avail. But this
> seems par for the Interbase docs, which are terrible. No wonder Borland
has
> had such a hard time selling Interbase to customers.

Embedded SQL guide, page 182:

Formatting dates for input
Dates for input as datatype DATE can have any of the following forms:
YYYYpMMpDD
MMpDDpYYYY
DDpMMpYYYY
YYpMMpDD
MMpDDpYY
DDpMMpYY
where:
DD = one- or two-digit day
MM = one- or two-digit month,
or a three-letter month abbreviation,
or the full English month name (case does not matter)
YY = last two digits of a year
YYYY = four-digit year
p = any ASCII punctuation character; extra whitespace (tabs or spaces) is
ignored

... there is a whole lot more information here.


--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
It used to be that other people's achievements were considered an
inspiration, not a grievance.
Re: Converting DATE. TIME, and TIMESTAMP values for SQL
#11269
Author: Edward Diener
Date: Mon, 02 Dec 2002 04:09
28 lines
2302 bytes
"Wayne Niddery [TeamB]" <wniddery@chaff.aci.on.ca> wrote in message
news:3deaa602$1@newsgroups.borland.com...
> "Edward Diener" <eddielee@tropicsoft.com> wrote in message
> news:3dea6388$1@newsgroups.borland.com...
> > How does one convert:
> >
> > 1) A 32-bit integer date value to an acceptable SQL value for a DATE
> column,
> > or does a 32-bit numeric value suffice ?
> > 2) A 32-bit integer time value to an acceptable SQL value for a TIME
> column,
> > or does a 32-bit numeric value suffice ?
> > 3) A 64-bit large integer value to an acceptable SQL value for a
TIMESTAMP
> > column, or does the 64 bit numeric value suffice ?
>
> It is impossible to answer this without knowing what the base and format
of
> these 32 / 64 bit values are. Is the 32 bit date a number of days? If so
> what date does a value of 0 equal? Is the Time value a number of seconds,
> milliseconds, ...?

This is all explained in the Data Definition Guide under the topic "DATE,
TIME, and TIMESTAMP datatypes". But I do see a slight mention of conversion
routines which go from the internal type to a C struct and then I recall in
the Embedded SQL guide some info about converting from the C struct to
acceptable SQL formats. I will work my way through all of that and come up
with a solution. Thanks !
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads