date format incorrect

  • Thread starter Dominique Vandensteen
  • 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
 
B

Bret Mulvey [MS]

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.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top