Date Fields in Paradox and Dbase when using Delphi 2 
Author Message
 Date Fields in Paradox and Dbase when using Delphi 2

Have noted that the Paradox and Dbase date fields allow only 2 digits for
the year, rather than 4.

Does delphi 4 have any solutions to this problem, or is it necessary to go
to a user-defined set of date fields which allow 4 digits for the year?

Thanks,

Hal Erdley



Wed, 18 Jun 1902 08:00:00 GMT  
 Date Fields in Paradox and Dbase when using Delphi 2


Quote:
>Have noted that the Paradox and Dbase date fields allow only 2 digits for
>the year, rather than 4.

>Does Delphi 4 have any solutions to this problem, or is it necessary to go
>to a user-defined set of date fields which allow 4 digits for the year?

There are two configuration settings areas that govern two- versus
four-digit years: the BDE configuration and the setup of visual controls.
These two settings areas are also mutually exclusive. That is, even if you
set up the BDE to treat years in dates as you intend, unless you set up the
visual controls you will only see two dates.

You can control how visual controls display date values *across the whole
system* by Registry settings made through the Control Panel. In Delphi 3
and above (not sure about Delphi 2), you can also control this just within
the scope of an application. This is done by setting ShortDateFormat to the
desired date template. For example:

  ShortDateFormat := 'mm/dd/yyyy';

For the BDE settings, see the System settings in the BDE Administrator.
There are a number of settings pertaining to how dates are treated by the
BDE.

Last, even though you are only seeing two digits for a given date value's
year, rest assured that *some* century was being stored with all dates.
Paradox date values are stored as type Double, with the digits to the left
of the decimal being a number of days after a baseline date of December 31,
1899. So a year format is a moot question and depends on how it is entered
by the end-user. In dBASE tables, dates are stored as text in the format
YYYYMMDD. The BDE translates this text value into a Double type so that it
is compatible with Delphi. In this case, too, *some* century is being
stored.

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "The knowledge of the world is only to
Technical Publications              be acquired in the world, and not in a
INPRISE Corporation                 closet."
http://www.inprise.com/delphi          -- Earl of Chesterfield (1694-1773)



Wed, 18 Jun 1902 08:00:00 GMT  
 Date Fields in Paradox and Dbase when using Delphi 2

Quote:
>Have noted that the Paradox and Dbase date fields allow only 2 digits
for
>the year, rather than 4.

Hal,

Not true. Look at the BDE configuration, which has a specific option
for 4-digit years.

Now read on... Here's part of a recent reply by Steve Koterski of
Inprise Tech Publications on another Delphi newsgroup:

<quote>
In Paradox tables, date values are stored neither in the US date
format
(MM/DD/YY) nor the European date format (DD/MM/YY). Rather, a date is
stored as a number, where the digits to the left of the decimal are
the
number of days after (or before) a baseline date of December 31, 1899.
<unquote>

So the value stored in a database date field has nothing to do with
date format, number of year digits, etc, *until* it is displayed.

*Then* the format depends on what the user has selected in the Windows
Control Panel, Regional Settings. For some reason Microsoft have
deemed it unnecessary to include a 4-digit year option in the Short
date format, but there's nothing to stop you manually entering
"dd/mm/yyyy" or "mm/dd/yyyy".

In your Delphi applications, you can override this and set the date
format to whatever you want with ShortDateFormat and LongDateFormat
(see Delphi online help).

--
Stephen Brown



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Wildcarding a Paradox Date Field - Using locl SQL

2. Using b.c. Dates In Date fields

3. Using the Date value for assigning Today's date to a field

4. dBase Date search using SQL

5. Local dBase 4-digit date field

6. using date field in a query

7. Using date fields

8. Can't modify fields of a Query when using 2-3 dBase tables

9. Can't modify fields of a Query when using 2-3 dBase tables

10. Using Paradox or dBASE tables?

11. Querying Paradox Date Field??

12. Searching date and time fields in paradox

 

 
Powered by phpBB® Forum Software