Where does the short date format come from?

  • Thread starter Thread starter MattB
  • Start date Start date
M

MattB

I've hit a snag with an application I wrote because of the differing
date formats in different countries.

It's a set of pages that make calls to a COM object that I have wrapped
in a web service. The COM object isn't mine, and it wants to receive
dates in a short date format, and it seems to inherit the localized
settings of it's host machine. The machine with that service/COM object
is in Canada and is set to use dd/mm/yyyy date format, and the server
with the pages is in the US and is using mm/dd/yyyy.

When I make calls to the web service, I'm converting the date sent in
using Date.ToShortDate (which I realize now was a bad decision). I
figured I could get around this by changing the pages server to use
dd/mm/yyyy via the Control Panel, but it seems to have no effect on the
short date being passed to the web service.

Does asp.net have a setting elsewhere that sets this? Any other ideas
(that don't require a code change)? Thanks!

Matt
 
ToShortDateString uses the current thread's CultureInfo object. That class
defines the structure of dates, times, numbers, currency and a few things
about text. Every thread has one.

Since this issue also affects validators, take a look at the section
"Validators support for globalization" in my article at
http://aspalliance.com/699. It will give you specifics.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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

Back
Top