date format incorrect

  • Thread starter Thread starter Dominique Vandensteen
  • Start date Start date
D

Dominique Vandensteen

I have this code
Now().ToString("MMM-yyyy")
this should return something like Oct-2003
it works fine in a normal vb.net program
when I run this from aspx it returns oct.-2003
the first letter isn't a capital anymore and a point is added
the IIS and the standalone vb.net program are running on the same machine
anybody an idea how i can configure IIS to have the same result?

dominique
 
Dominique Vandensteen said:
I have this code
Now().ToString("MMM-yyyy")
this should return something like Oct-2003
it works fine in a normal vb.net program
when I run this from aspx it returns oct.-2003
the first letter isn't a capital anymore and a point is added
the IIS and the standalone vb.net program are running on the same machine
anybody an idea how i can configure IIS to have the same result?

dominique

Check to see what language/region setting your web browser (or other client)
is using. The behavior of the MMM date format is dependant on the current
thread culture. In IIS this is determined by an HTTP header in the request,
which isn't the case in a non-IIS-based application.

Typically you'll see "Oct" for English, Spanish, Persian, and Swahili, and
"oct." for French and Romanian. I'm guessing that your operating system is
set to English and your browser is set to French.

You can force it to display "Oct" by setting Thread.Current.CultureInfo to
U.S. English temporarily, but if you want your application to be globalized
you should consider leaving it as-is. Better yet, allow the date format to
be configurable for each culture instead of always using MMM-yyyy.
 
Back
Top