I am working in a web application using VB.NET. It also has mixed VisualBasic code, in particular the Date variable and the VB month function.
The problem is this part:
Month("10/01/2008")
On servers, I get 10 (October) as the month (which should be correct). On my machine, I get 1 (January) (which should be wrong).
Two of my colleagues (on their own machines) receive different answers, one received 1, the other received 10.
The question is why is this so?
In the end, I can solve this problem using the .NET DateTime Parse (or ParseExact) function to make everything be in the "dd / MM / yyyy" format. It works. I'm just wondering why there is inconsistency.
Additional information: I know that the parameter for the month function must be a Date variable. The code used the string as a parameter, and the Strict parameter was turned off, and the developers basically let VB do their own conversion thing. (Serving outdated code has a lot of inertia ...)
If this helps, the version of Microsoft.VisualBasic.dll on the servers 7.10.6310.4 (in the folder Framework v1.1.4322). The version on my (and my 2 colleagues) machines is 7.10.6001.4.
Edit: regional settings for all machines already installed in dd / MM / yyyy format (short date format).
source
share