gstark wrote:
Hi,
I have a difference between machines in the date formats they produce. This
one web application has this code. Me.txtRxDate.Text =
Now().ToShortDateString. On the development server, the browser displays
the date as: 2/27/2007
When I goto the production server, the same browser displays the date as:
2/27/07.
Where is this controled? It's not the "Regional and Langauge Settings",
both machines are set the same.
Greg
It's controlled by the regional settings, but not the regional settings
of your user account. That's why you can't change it from the control panel.
IIS gets the culture settings from somewhere (perhaps an admin account,
I am not certain, and it has changed from version to version) and
creates a CultureInfo object for that culture and puts in
CultureInfo.CurrentCulture. That object is used for culture dependent
operations whenever you don't specify any culture.
You can create your own CultureInfo object and use for culture dependent
operations. You can also use CultureInfo.InvariantCulture for culture
neutral effect.
ToShortDateString doesn't have any override that takes a format
provider, but it is implemented exactly as ToString("d"), so you can use
the override of ToString that takes a format provider.
Example using a swedish culture info object, which will give the result
"2007-02-27":
Dim t As String = Now().ToString("d", new CultureInfo(1053))
--
Göran Andersson
_____
http://www.guffa.com