String was not recognized as a valid DateTime

0
0

 

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”

 

Some idea?

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

so…

What can I do?

 

Thanks.

  • You must to post comments
0
0

Hi Mark,

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.

Best,

Luca

 

  • You must to post comments
0
0

If I use….

‘Dim d As DateTime = Date.Parse(hf, CultureInfo.CreateSpecificCulture(“InvariantCulture”))….. now works great on the server.. but now the error is in my developer computer. 🙁

So strange…

Some idea?

  • You must to post comments
0
0

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.

Best,

Luca

 

  • You must to post comments
0
0

This is the problem:

‘Dim d As DateTime = hf

I tried also this…

‘Dim d As DateTime = Date.Parse(hf, CultureInfo.CreateSpecificCulture(“es-MX”))

 

Some idea?

 

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”
End If

 

 

  • You must to post comments
0
0

 

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.

 

 

Attachment
  • You must to post comments
0
0

That’s an error coming from the .NET DateTime parser. Can you send me the json setting you used and the text that is giving the error?

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.