954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Borland's function StrToDateTime fails

Hello,
I have problem using StrToDateTime function from Borland in my project. I made a custom component, it's called Month view (calendar). One of the basic steps of the component's initialization is to set the default month and year. To do this, I use the "1/1/2010" string passed to StrToDateTime function. Everything runs OK on my PC but as soon as I try running the application on another PC, it says: "'1/1/2010' is not a valid date". The initialization will fail and calendar won't show up.
Please help me...

Thew
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

That's most likely because the other computer has a different locale. For example, the same date might have to be specified as 01.01.2010 on that system.

Aranarth
Posting Whiz in Training
253 posts since May 2010
Reputation Points: 155
Solved Threads: 47
 

How can I set it up on Windows XP and Windows 7?
I can't see any differences, this is my Win 7 setting: d. M. rrrr

Thew
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 
How can I set it up on Windows XP and Windows 7?


Set up what?I can't see any differences, this is my Win 7 setting: d. M. rrrr
Then it wouldn't be too surprising if 1/1/2010 is not considered a valid date.

Aranarth
Posting Whiz in Training
253 posts since May 2010
Reputation Points: 155
Solved Threads: 47
 

Well, the funny part is that this date: 1/1/2010 with this setting: d. M. rrrr is valid on my PC.

Thew
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

That's funny indeed. Instead of relying on the erratic VCL, it's probably better to use a recognized library such as Boost.Date_Time for your needs.

Aranarth
Posting Whiz in Training
253 posts since May 2010
Reputation Points: 155
Solved Threads: 47
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: