Date format broken in .net 4.0 for uk format

I'm in the process of converting multiple sites to .net 4.0, and I seem to have a problem with regional dates.

This code:

Date.Today.AddDays((Date.Today.DayOfWeek - 1) * -1).ToString()

In .net 3.5 it is issued: '19 / 04/2010 00:00:00 'but as soon as I changed the application pool to 4.0, you get: "4/19/2010 12:00:00 AM"

Where can I change the setting that governs this?

+5
source share
1 answer

I don't think you can try this though ...

Date.Today.AddDays((Date.Today.DayOfWeek - 1) * -1).ToString(dd/MM/yyy hh:mm:ss); 

This should format the date as you need.

Microsoft basically rebuilt quite a bit from scratch for .net 4.0 ... it's a pain in some areas like this, but a real advantage in others.

, , , datetime.tostring.

, , , .

, .

+2

All Articles