Hi, I have my App working perfectly on my developer computer.
When I upload my App to my Server in one function i’m getting this error: “String was not recognized as a valid DateTime”
Why in my computer work’s! and in the Server doesn’t work?
I tried the Regional Setting’s but is the same… and my application has the ‘culture’ setting on the .json file
What can I do?
For the invariant culture you don’t have to create it. It’s always available as CultureInfo.InvariantCulture.
The problem is what I thought. The string you are using is not a valid es-MX date string. See localization here: https://wisej.com/docs/html/Localization.htm – the last part about the browser.
Basically, if you set the culture to es-MX then Wisej will update the culture on the thread, just like it would work if you were using an application on a es-MX installation of Windows. If your code needs to handle invariant data, then you should use CultureInfo.InvariantCulture. That’s normal for localized applications.
DateTime.Parse() is not specific to VWG – it’s a .NET class that works the same in any framework. If you get a format error it means that the string you are passing is not a valid date according to the culture.
The problem may be that the string you are passing is not valid for “es-MX”. VWG failed to restore the culture so you may have been parsing a en-US (or invariant – which is the same) string. In fact when you specify es-MX you get the error. Try with InvariantCulture. Also check the value of “hf”, without knowing what is the string it’s impossible to know if you are passing the wrong value or using the wrong culture.
As I said, this is all related to .NET, it’s not a Wisej or VWG specific issue other than that Wisej preserves the culture setting.
This is the problem:
‘Dim d As DateTime = hf
I tried also this…
‘Dim d As DateTime = Date.Parse(hf, CultureInfo.CreateSpecificCulture(“es-MX”))
In the VWG is the same code and i don’t have this error (‘Dim d As DateTime = hf ‘ this line work in VWG).
If DateDiff(DateInterval.Day, d, Fu.getServerDateTime) > 2 Then
j.ImageSource = “/icons/attentionh.png”
This is my Json file.
The text that giving this error.. I don’t know.. is very big coding in my app.. I only see this error message: “String was not recognized as a valid DateTime” in a modal message box.
Please login first to submit.