skip to Main Content

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

Locale

Locale2

Whenever I run the system this error occurs

Error

I know this error because of the date format.
Here is a sample query
Sample

How to fix this?

2

Answers


  1. 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")
    
    Login or Signup to reply.
  2. Try forcing culture via web.config using GlobalizationSection class:

    <system.web>
        <globalization uiCulture="en-us" culture="en-us" />
    </system.web>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search