Sorry about the bum Format advice - hope it didn't cost too much time.
Discovered that Short Date Formats without separators are allowed in Delphi,
Windows and Excel and create various problems.
Going from date to string is OK in all cases but back the other way is
another matter.
Delphi stops with EConvertError & 'invalid date' message. Requires a date
separator for strtodate to work.
Using a DBGrid doesn't avoid this - dates are displayed ddmmyy but you can't
change them (strtodate underneath of course).
Excel is more interesting, it accepts a custom date format of 'ddmmyy' and
then proceeds to convert whatever you enter into some other date - no
warnings just erroneous results.
They must have assumed no one would actually be dumb enough to try this <g>.
-----Original Message-----
From: CSI Mail <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Saturday, September 11, 1999 12:08 AM
Subject: Re: [DUG]: Dates
Many thanks Max for your time, just what I needed
didn't get far with the Format for some reason but used
s:=Copy(s,1,2)+'/'+Copy(s,3,2)+'/'+Copy(s,5,2);
worked a treat
Patrick Sheehan
----- Original Message -----
From: Max Renshaw-Fox <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: 10 September 1999 20:55
Subject: RE: [DUG]: Dates
>
> If it's a one-off, and elegance is not an issue, - also assuming the dates
> are all in the same known format, how about just creating a new string by
> using "copy()" 3 times - as in
>
> Format(%s/%s/%s, [Copy(s, 1, 2), Copy(s, 3, 2), Copy(s, 5, 2)])
>
> Max
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of P Sheehan
> Sent: Friday, 10 September 1999 18:10
> To: Multiple recipients of list delphi
> Subject: [DUG]: Dates
>
>
> Hi all
>
> I have a couple of thousand dates in string format ie '100999' in a
> database field.
> To convert to Date format I need to insert a charater as a date separator
as
> defined by the date separator global variable.
>
> How do I get the "/" into the string so I can do a StrtoDate().
> any help appreciated
>
>
> Patrick Sheehan
> P+A Computing
> Patrick Anthony Associates Ltd
> 166 Kitchener Rd Milford
> PO Box 31-831 Milford
> [EMAIL PROTECTED] [EMAIL PROTECTED]
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz