DateTime::Parse problem

G

Guest

Hi all,

I'm running, or trying to run, a managed C++ application on the .Net framework 1.0 on a Win 98 SE machine, with intel processor(no other details at this point).

I'm getting the following error, and can't figure out why exactly.

"system.format.exception "String was not recognised as a valid datetime at system.datetimeparse.getdayofnnn( dateTimeResult result.datetime RawInfo Raw.datetimeformatinfo dtfi)"

(This message was read out over the phone so may not be completely accurate)

I've set up a test machine with Win 98 SE os, but can't duplicate the error. Looking at my code, I have a line that reads;

"DateTime::parse(daGolf->m_DateTourneyStarted)" where the value in daGolf->m_DateTourneyStarted = "26/01/04".

I'm guessing the problem must lie in the date value, and if I convert it to "26/01/2004" it might go away. But why hasn't it occured on Win XP, Win ME, or my test machine with Win 98 SE?

Any insight into this would be appreciated.

Regards,

Christo
 
J

Jerry III

You need to pass valid format provider to the Parse method - either a
hardcoded one (seems tobe your case as you expect a single format that will
always be the same) or one based on user's locale (which is the default, the
user that runs your code has a different date format setup than what they're
entering).

Jerry

Christo said:
Hi all,

I'm running, or trying to run, a managed C++ application on the .Net
framework 1.0 on a Win 98 SE machine, with intel processor(no other details
at this point).
I'm getting the following error, and can't figure out why exactly.

"system.format.exception "String was not recognised as a valid datetime at
system.datetimeparse.getdayofnnn( dateTimeResult result.datetime RawInfo
Raw.datetimeformatinfo dtfi)"
(This message was read out over the phone so may not be completely accurate)

I've set up a test machine with Win 98 SE os, but can't duplicate the
error. Looking at my code, I have a line that reads;
"DateTime::parse(daGolf->m_DateTourneyStarted)" where the value in
daGolf->m_DateTourneyStarted = "26/01/04".
I'm guessing the problem must lie in the date value, and if I convert it
to "26/01/2004" it might go away. But why hasn't it occured on Win XP, Win
ME, or my test machine with Win 98 SE?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top