Bug 52427 - Mono.Data.Sqlite fails to retrieve DateTime in UTC format
Summary: Mono.Data.Sqlite fails to retrieve DateTime in UTC format
Status: RESOLVED DUPLICATE of bug 46929
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Data.Sqlite ()
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2017-02-09 20:55 UTC by Mus
Modified: 2017-02-24 15:39 UTC (History)
5 users (show)

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

Sample IOS app to easily reproduce the issue (9.35 KB, application/zip)
2017-02-09 20:55 UTC, Mus

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 GitHub or Developer Community 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:

Description Mus 2017-02-09 20:55:43 UTC
Created attachment 19778 [details]
Sample IOS app to easily reproduce the issue

Issue with Xamarin 6.1.5 and  Mono.Data.Sqlite assembly version When we store UTC DateTime values with UTC Kind in SQLLite(DateTimeKind=Utc was set in the connection string), the values retrieved had a Local datetime format with Local Kind instead of UTC format. 

To reproduce it : Use the attached IOS app
1/ Create a db in SQLite, set the connection string with DateTimeKind=Utc.
2/ Insert in a table a UTC datetime with UTC Kind.
3/ Retrieve the date stored from the db : the date retrieved has a Local format with a local kind!
   -> the retrieved date should be in the UTC format with a UTC kind  

Note : if you run the same attached app on Xamarin 6.0.2 you get a date in UTC but with Unspecified kind !! 

Thanks For your help
Comment 1 Manuel de la Peña [MSFT] 2017-02-10 11:19:26 UTC
I have confirmed the bug with the following environment and that it happens when using the provided code and when the data is retrieved via a reader.GetDateTime(). Reassigned to the mono team.

Env used to confirm the bug:

=== Xamarin Studio Community ===

Version 6.1.5 (build 0)
Installation UUID: 01060673-5bee-4cf4-a4c2-5e36a18d39a2
	Mono 4.8.0 (mono-4.8.0-branch/e8f4c7c) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000289

=== NuGet ===


=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.2.1 (11766.1)
Build 8C1002

=== Xamarin.Mac ===

Version: (Xamarin Studio Community)

=== Xamarin.Android ===

Version: (Xamarin Studio Community)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)

SDK Tools Version: 25.1.6
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: (Xamarin Studio Community)
Hash: ef14179f
Branch: fix-46394
Build date: 2017-02-10 11:26:02+0100

=== Xamarin Inspector ===

Hash: 1f3067d
Branch: master
Build date: 11/15/2016 10:13:59 PM

=== Build Information ===

Release ID: 601050000
Git revision: 7494718e127af9eaec45a3bd6282d3da927488bd
Build date: 2017-01-17 10:31:01-05
Xamarin addins: c92d0626d347aaa02839689eaac2961d24c9f446
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.12.3
Darwin MacBook-Pro.local 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Addin Maker 1.3.2
StyleCop Support
Xamarin Inspector
Comment 2 Marek Safar 2017-02-10 11:57:24 UTC
Egor, could you look into it. It could be fixed by our recent changes there but needs to be checked
Comment 3 Marek Safar 2017-02-24 15:39:38 UTC

*** This bug has been marked as a duplicate of bug 46929 ***
Comment 4 Marek Safar 2017-02-24 15:39:56 UTC
Thanks for the test case!