| View previous topic :: View next topic |
| Author |
Message |
Tracy Stevens Guest
|
Posted: Tue Jul 15, 2003 3:10 pm Post subject: Re: ...not a valid date and time. |
|
|
I'm not sure I understand what you're asking. Yes, I have tried removing
the leading zero from the string before attempting to convert it, but that
failed also.
Are you referring to something else?
"Liz Albin" <lizalbin (AT) yahooNotThis (DOT) com> wrote
| Quote: | On Tue, 15 Jul 2003 09:53:31 -0500, Tracy Stevens wrote:
I get the message "'07/15/2003' is not a valid date and time."
Have you tried with 7/1/2003?
I ask because it's possible your system date format is not what you
believe it to be.
--
liz
|
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Jul 15, 2003 3:21 pm Post subject: Re: ...not a valid date and time. |
|
|
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote:
| Quote: | [...]
AnsiString temp = date_list->Strings[curr_index];
TDateTime new_dt = StrToDateTime(temp);
I get the message "'07/15/2003' is not a valid date and time."
|
When I used:
String tmp = "07/15/2003";
TDateTime dt = StrToDateTime( tmp );
It executed without an error.
Has your date seperator changed?
~ JD
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Tue Jul 15, 2003 4:02 pm Post subject: Re: ...not a valid date and time. |
|
|
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote:
| Quote: |
It used to work fine for me, too.
Where could I see if the date separator changed?
|
Check the Windows Date/Time Settings in Control Panel | Regional Settings. See if they match your expected settings
Other way is to force the Application settings by using the
global variables 'DateSeparator'...
Look for DateSeparator on the BCB Help System.
HTH
Antonio
|
|
| Back to top |
|
 |
Tracy Stevens Guest
|
Posted: Tue Jul 15, 2003 4:12 pm Post subject: Re: ...not a valid date and time. |
|
|
My Windows DateTime settings are set correctly as M/d/yyyy with a date
separator of '/'.
My TDateTimePicker works if the DateTime entered is '27/1/03' but not if it
is '27/1/2003' nor '7/15/03'.
So, apparently it is expecting the input to be in the form of dd/mm/yy.
Where do I change this to what I want?
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote
| Quote: | I have been using this same line of code in an application without any
problem. However, it started failing recently and I can't determine why.
In a TStringList I store several date values of the form "07/15/2003".
AnsiString temp = date_list->Strings[curr_index];
TDateTime new_dt = StrToDateTime(temp);
I get the message "'07/15/2003' is not a valid date and time."
I am using BCB4.
Thanx,
Tracy
|
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Jul 15, 2003 4:56 pm Post subject: Re: ...not a valid date and time. |
|
|
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote:
| Quote: | [...] My TDateTimePicker works if the DateTime entered is
'27/1/03' but not if it is '27/1/2003'
|
Not a problem ... Just use StrToDate() instead.
~ JD
|
|
| Back to top |
|
 |
Tracy Stevens Guest
|
Posted: Tue Jul 15, 2003 5:02 pm Post subject: Re: ...not a valid date and time. |
|
|
But how would I know which format to change the final product to? I know in
which format I'm storing the strings, but how would I know what the output
should be if it's run on someone else's computer?
And why would this same TDateTimePicker be using European dates all of a
sudden? Corruption?
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: |
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote:
[...] My TDateTimePicker works if the DateTime entered is
'27/1/03' but not if it is '27/1/2003'
Not a problem ... Just use StrToDate() instead.
~ JD
|
|
|
| Back to top |
|
 |
Patrick Wong Guest
|
Posted: Fri Aug 01, 2003 1:40 am Post subject: Re: ...not a valid date and time. |
|
|
"Tracy Stevens" <eat (AT) joes (DOT) com> wrote
| Quote: | I have been using this same line of code in an application without any
problem. However, it started failing recently and I can't determine why.
In a TStringList I store several date values of the form "07/15/2003".
AnsiString temp = date_list->Strings[curr_index];
TDateTime new_dt = StrToDateTime(temp);
I get the message "'07/15/2003' is not a valid date and time."
I am using BCB4.
Thanx,
Tracy
|
I had a similar problem days before. I used a TListView to store datetime
values, and when I retrieved the value for manipulation I encounter the same
message. I stepped in the code and traced the exact value stored and found
that the string had a 'n' and 'r' (0x0a and 0x0d respectively) appended.
I called the AnsiString's method TrimRight() to remove the control
characters and got rid of the problem. Take a try... :-)
Patrick.
|
|
| Back to top |
|
 |
David Erbas-White Guest
|
Posted: Fri Aug 01, 2003 2:23 am Post subject: Re: ...not a valid date and time. |
|
|
Patrick Wong wrote:
| Quote: | "Tracy Stevens" <eat (AT) joes (DOT) com> wrote in message
news:3f141520$1 (AT) newsgroups (DOT) borland.com...
I have been using this same line of code in an application without any
problem. However, it started failing recently and I can't determine why.
In a TStringList I store several date values of the form "07/15/2003".
AnsiString temp = date_list->Strings[curr_index];
TDateTime new_dt = StrToDateTime(temp);
I get the message "'07/15/2003' is not a valid date and time."
I am using BCB4.
Thanx,
Tracy
|
Also, see if you have changed your global settings (i.e., MM/DD/YY vs.
DD/MM/YY). This will give a similar result.
David Erbas-White
|
|
| Back to top |
|
 |
|