Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Dates
Thu, Mar 9 2006 2:37 PMPermanent Link

"Allan Brocklehurst"
Hello;
Stats D7 Ent
V4.22b7
PC W2K PRO
Server W2K
My PC's System Short Date is  "yyy-mm-dd"
On the server the System Short Date is   "M/d/yyyy"

I have in my code  the following
ShortDateFormat := 'yyyy-MM-dd';

Problem : When the App is  run on the server. It  kicks up an error
"1994-06-27" invalid date
I changed the Code to send this  "06/27/1994" and I still get an invalid
date

How can I write for both PC and Server without changing the System "Short
date" format on the server

TIA

Allan Brocklehurst

Thu, Mar 9 2006 3:05 PMPermanent Link

"Ralf Mimoun"
Allan Brocklehurst wrote:
....
> How can I write for both PC and Server without changing the System
> "Short date" format on the server

Always use AnsiDateToStr() (TDBISAMEngine method) to convert a TDateTime to
a date string. DBISAM uses the ANSI date format, means yyyy-mm-dd.

Ralf
Thu, Mar 9 2006 3:30 PMPermanent Link

"Allan Brocklehurst"
Ralf;
Hi. I'm reading a date from a text table as in "20060119" . I want to
format it to fit the dbisam date format on the server which  is picking up
the System Short Date Format.
I got permission to change the Server Short date format but, not all Admin
people will allow me to do that.
Can I change the DBISAMDB to expect/Accept a date format other than the
system  short date format" as in a change to an "ini" file or something?

Allan

Allan
"Ralf Mimoun" <nospam@rad-on.de> wrote in message
news:9D4008AC-77D3-49D6-8C6E-3C190C6926D1@news.elevatesoft.com...
> Allan Brocklehurst wrote:
> ...
> > How can I write for both PC and Server without changing the System
> > "Short date" format on the server
>
> Always use AnsiDateToStr() (TDBISAMEngine method) to convert a TDateTime
to
> a date string. DBISAM uses the ANSI date format, means yyyy-mm-dd.
>
> Ralf
>

Thu, Mar 9 2006 3:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Allan,

<< Hi. I'm reading a date from a text table as in "20060119" . I want to
format it to fit the dbisam date format on the server which  is picking up
the System Short Date Format. I got permission to change the Server Short
date format but, not all Admin people will allow me to do that. Can I change
the DBISAMDB to expect/Accept a date format other than the system  short
date format" as in a change to an "ini" file or something? >>

DBISAM only accepts ANSI format dates (yyyy-mm-dd).  What are you attempting
to do that is causing the error - execute an SQL statement with that date
constant ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Mar 9 2006 4:13 PMPermanent Link

Allan brocklehurst
Tim Young [Elevate Software] wrote:
> Allan,
>
> << Hi. I'm reading a date from a text table as in "20060119" . I want to
> format it to fit the dbisam date format on the server which  is picking up
> the System Short Date Format. I got permission to change the Server Short
> date format but, not all Admin people will allow me to do that. Can I change
> the DBISAMDB to expect/Accept a date format other than the system  short
> date format" as in a change to an "ini" file or something? >>
>
> DBISAM only accepts ANSI format dates (yyyy-mm-dd).  What are you attempting
> to do that is causing the error - execute an SQL statement with that date
> constant ?
>
Tim;
I walked out of the building to get home. AS soon as the freah air hit
me ,I realized what Ralf and now you are saying

thanks again

Allan
Fri, Mar 10 2006 9:53 AMPermanent Link

"Allan Brocklehurst"
Tim;


a follow up and a solution for me and maybe will help others

Reading T_DOB from a String
T_DOB will be a date or blank
T_DOB := '2006-03-01' or ''

This works when the System Short date is set to "yyyy-mm-dd" even if the
T_DOB is null
MeditechData.FieldByName('DOB').AsString := Engine.AnsiStrToDate(T_DOB);

This works when the System Short date is set to "d/mm/yyyy" or any other
Short Date format but, bombs when the T_DOB is null
MeditechData.FieldByName('DOB').Value := Engine.AnsiStrToDate(T_DOB);

**** BEST SOLUTION ****
This works when the System Short date is set to "d/mm/yyyy" or any other
Short Date format
if trim(T_DOB) <> '' then
MeditechData.FieldByName('DOB').Value := Engine.AnsiStrToDate(T_DOB);

Allan



"Allan brocklehurst" <brock@ns.sympatico.ca> wrote in message
news:B70223DB-A2B9-496C-9575-C084CDB74B2B@news.elevatesoft.com...
> Tim Young [Elevate Software] wrote:
> > Allan,
> >
> > << Hi. I'm reading a date from a text table as in "20060119" . I want to
> > format it to fit the dbisam date format on the server which  is picking
up
> > the System Short Date Format. I got permission to change the Server
Short
> > date format but, not all Admin people will allow me to do that. Can I
change
> > the DBISAMDB to expect/Accept a date format other than the system  short
> > date format" as in a change to an "ini" file or something? >>
> >
> > DBISAM only accepts ANSI format dates (yyyy-mm-dd).  What are you
attempting
> > to do that is causing the error - execute an SQL statement with that
date
> > constant ?
> >
> Tim;
> I walked out of the building to get home. AS soon as the freah air hit
> me ,I realized what Ralf and now you are saying
>
> thanks again
>
> Allan

Image