Date problem?

  • Thread starter Thread starter Jacek Jurkowski
  • Start date Start date
J

Jacek Jurkowski

Why on some computers DateTime.Today.ToShortDateString()
returns date in "9999-99-99" format and on other machines
I get "99-99-99"? How to make it independent?
 
Why on some computers DateTime.Today.ToShortDateString()
returns date in "9999-99-99" format and on other machines
I get "99-99-99"? How to make it independent?

Does it has to do with the Local Settings in control panel? You can
specify the date/time/number format under regional settings.


Regards,
 
Jacek,

If you want to make it independent then you can specify the format
string in the call to ToString. In your case, I assume you want a
four-digit year, so you would use a format of:

yyyy-MM-dd

Hope this helps.
 
Hi Jacek,

It depends of the Regional Options as defined in the control panel. If you
want to make it independed you need to use ToString(IFormatProvider).

Hope this help,
 
Back
Top