:-0 
Is it?
I never know.
I think it should come from the system locale.
In that case this routine still works.
I gess the hardest part is the MM-DD-YYYY against DD-MM-YYYY.
I have seen that theres anly 3 combinations posible in Delphi. 
DD-MM-YYYY
MM-DD-YYYY
And
YYYY-MM-DD

Where - is anny date seperator.

I tried once to set it to something like DD-YYYY-MM.
In Windows this worked(display time etc) but Delphi StrToDate choked on
it.

Now I know no one will use this format it was just for me to see what
format was used.
As in a Terminal server enviroment the defaul settings of the system
sometimes was set in a user session (I still don't know why) and as the
server is usaly English and the masks are all in Dutch this happened
sometimes. When we where still deling with The bde and oracle this error
made the date insert of oracle go wrong and it inserted absurd dates. I
logged a call at Oracle complaining about the strange data insert. They
said it was not there problem. They don't check the dates for validity.
So I neede to write a trigger that would atleast check for this strange
data.

So you are warned if you need the dateformat on a terminal server it can
act verry strange.


Met vriendelijke groet, 
Pieter Valentijn
 
Delphidreams
http://www.delphidreams.nl
 


-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Michael
Van Canneyt
Verzonden: zondag 25 februari 2007 21:30
Aan: [email protected]
Onderwerp: RE: [lazarus] StrToDate error




On Sun, 25 Feb 2007, Pieter Valentijn wrote:

> Should be easy.
> 
> Function MyStrToDate(Astr : String) : TDateTime ;
> Begin
>  Astr := StringReplace(Astr,'-',DateSeparator,[rfReplaceAll]);
>  Astr := StringReplace(Astr,'/',DateSeparator,[rfReplaceAll]);
>  result := StrTodate(Astr);
> End;
> 
> This should work on anny string with anny format.

Except in Belgium, where the official date separator is a space, 
so I'd get a string like '2007 02 27'. 

You should always simply set the date separator char to the correct
value.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to