Share via

Why dot.net objects work differently in windows and Android???

Lloyd Sheen 1,491 Reputation points
2024-02-20T16:48:47.9233333+00:00

So since debugging with Android and the emulator is so horrible I am now debugging on windows (had to change init a bit as it reads a file). Now this way of doing things works well. Then KABANG!! I have an endpoint that need a date string in the format 2024-02-20 (example) so I was using theDatePicker.Date.Date.ToShortDateString() and this worked will in windows. So I would get the following string in windows - 2024-02-20 Now after the code works I switch to Android and run it to test on Android and well it doesn't the string is - 2/20/2024 which causes the endpoint to fail. Perhaps the ads for Maui should read "the majority of the time it works on all platforms". So as I have said on prior posts I spend as much time debugging Maui and VS as I do my app. Why????

Developer technologies | .NET | .NET Multi-platform App UI
0 comments No comments

Answer accepted by question author

Bruce (SqlWork.com) 84,086 Reputation points
2024-02-20T17:04:25.5766667+00:00

.ToShortDateString() uses the current culture unless passed. Android has a different default culture. The bug is in your code.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.