Bug 23824 - Wrong timezone / datetime
Summary: Wrong timezone / datetime
Status: RESOLVED DUPLICATE of bug 23405
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.18.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-10-14 15:32 UTC by Craig
Modified: 2014-10-15 05:00 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Screenshots (121.66 KB, application/x-zip-compressed)
2014-10-14 15:32 UTC, Craig
Details
Timezone Observation (568 bytes, text/plain)
2014-10-15 04:21 UTC, Arpit Jha
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED DUPLICATE of bug 23405

Description Craig 2014-10-14 15:32:52 UTC
Created attachment 8420 [details]
Screenshots

All dates are being displayed as one hour behind the actual time.  This has been tested on a handful of Android phones not just the emulator.  It may be related to our timezone (Central Daylight Time) and daylight savings time.  I can confirm that this bug did not previously exist for us, it was introduced by a Xamarin software update.  Phones that we've observed this error on include Samsung Galaxy S3, S4, & S5.

I set up a very simple test case to reproduce the issue.  See comments in the code below along with the accompanying screenshots:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace App1
{
    [Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            TextView myText = FindViewById<TextView>(Resource.Id.MyText);
            myText.Text = DateTime.Now.ToString("MM/dd/yyyy h:mm tt"); //displays date that is an hour behind
            myText.Text += " " + System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); //utc offset is -6 but should probably be -5
        }
    }
}
Comment 1 Craig 2014-10-14 22:58:04 UTC
I did some further testing. I can confirm that the root issue seems to be that the daylight savings offset is not accounted for.

Arizona doesn't observe daylight savings, if I switch my phone's time zone to Arizona (GMT-7:00) then the dates display correctly, but for any other time zone in the United States the dates display incorrectly.
Comment 2 Arpit Jha 2014-10-15 04:19:26 UTC
I have checked this issue and able to reproduce it with the help of bug descritpion.

I tried following steps to reproduce it.

I observed that except Arizona (GMT-7:00) date and time with time zone displaying incorrectly,Following are the observation with diffrent Time zone.
Device                                                      Output

TimeZone/Date                     
GMT-07:00 Mountain Standard Time 15/10/2014                  10/15/2014 12:43 am-07:00:00  (Correct)       
GMT-11:00 Samoa Standard Time 15/10/2014                     10/14/2014 08:52pm-11:00:00  (Incorrect)   
GMT+10:00 Chamorro Satndard Time 15/10/2014                   10/15/2014 06:01 pm 10:00:00  (Correct) 
GMT-05:00 Central Daylight Time 15/10/2014                   10/15/2014 02:04 am -06:00:00  (Incorrect)
GMT-08:00 Alaska Daylight Time 15/10/2014                   10/14/2014 11:07 am -09:00:00  (Incorrect)

Environment Info:
XVS 3.7.201.0
VS 2013 professional Update 3
Device : Samsung Galaxy S5
Comment 3 Arpit Jha 2014-10-15 04:21:53 UTC
Created attachment 8422 [details]
Timezone Observation
Comment 4 Marek Habersack 2014-10-15 05:00:32 UTC

*** This bug has been marked as a duplicate of bug 23405 ***