Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I have an web service reference in project. In one method my app invoke method, which returns two date. Code is pretty simple, no any date conversions or math:
Console.WriteLine("Date: " + elem.date + " | Begin date: " + elem.workTime.startTime);
Under iOS it returns:
Date: 05.03.2012 0:00:00 | Begin date: 05.03.2012 15:30:00
It's a good result.
Under Android it returns:
Date: 04.03.2012 23:00:00 | Begin date: 05.03.2012 14:30:00
One hour was subtracted.
If I switched to US locale, it returns:
Date: 3/4/2012 11:00:00 PM | Begin date: 3/5/2012 2:30:00 PM
Note that I use iOS and Android simulators with Russian locale. How could I take dates in any Android app part without taking into account any locale settings?
The problem is when I using web service. I tested web service via
SoapUI 3.6 - dates values are expected. In iOS simulator works fine
I noted that service reference code after calling method returns date
with kind = local. I tried to change it to unspecified with no
Example of raw data, which web service respond:
Ok. The problem that in Android 2.3 emulator Moscow timezone is GMT+3, but since 2011 it's GMT+4 at any time of year (without daylight +1 hour/-1 switching).
So the questions are:
1. Is it possible to update Moscow or Russian timezones in Android 2.3?
2. How to ignore timezones when Mono's web service wrapper reads dates from XML-response to DateTime variables?
So by default the DateTime class converts the Parsed time to whatever the current TimeZone is for the device / Emulator.
A workaround that seems to work for me is you can explicitly convert a DateTime to whatever timezone using code similar to this.
var theTime = DateTime.Parse("2012-03-07T00:00:00+04:00"); // Gives me 2012-3-06 15:00
var rusZone = TimeZoneInfo.FindSystemTimeZoneById("Europe/Moscow");
var convertedTime = TimeZoneInfo.ConvertTime(parsedTime, rusZone); // Now is 2012-3-07 00:00
I hope this helps.
Thank you. No more question about this issue.
Closing the bug