It is usually best to let users enter dates (and numbers) in the format they
are most familiar with. Trying to force them to do otherwise will only lead
to data entry errors.
The date format only matters when your application interacts with the
'outside world', i.e. your users or the database. Within the application,
the DateTime variables are independent of their value's textual
representation.
In your external interactions, use the appropriate CultureInfo object, which
you can then pass as the IFormatProvider argument to the DateTime's Parse or
ToString methods as appropriate.
The current user's CultureInfo is available through the CurrentUICulture
property of CultureInfo. It sounds like your database uses a specific
culture, for example: "new CultureInfo("EN-US")"
For more information, including code samples, look up these class and
interface names in the .NET framework documentation.
Jeffrey Sax
Extreme Optimization
http://www.extremeoptimization.com
"Jozef Jarosciak" <jo*@doprocess.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an application which imports fields from external source where
date format of one the collumns is English (United States): M/d/yyyy.
So July 1, 2005 equals to: 7/1/05
I am using this date everywhere in the application.
Problem is when someones is lets say in Portugal with the regional
settings for date set to DD-MM-YYYY.
I am going crazy to figure out how to make everyone to use M/d/yyyy
scheme without changing their regional settings, as lots of people
simply can't do that.
Can someone point me to what I could do, or post some code on how to go
around this annoying problem?
It would be very much appreciated.
Joe