I have this legacy system that needs to transfer to a new PC. I've transferred it to windows 10 PC with IIS 10. The problem is that CDate
Function in VB.net uses a different date format. The date format should be MM/dd/yyyy. But whenever I start the system, it uses the format dd/MM/yyyy. I cannot change the code of the system since it is very old and cannot be built again and it has multiple codes where it uses the CDate
function.
I have already changed the locale
Whenever I run the system this error occurs
I know this error because of the date format. Here is a sample query
How to fix this?
CodePudding user response:
The dateformat for sql query should be yyyy-MM-dd format. There for you can format the date in the code first by using
Format(Yourdate,"yyyy-MM-dd")
CodePudding user response:
Try forcing culture via web.config
using GlobalizationSection class:
<system.web>
<globalization uiCulture="en-us" culture="en-us" />
</system.web>