[Mono-bugs] [Bug 335464] New: DataColumn. DateTimeMode does not correctly effect DateTime stored in DataRow
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Oct 20 01:52:05 EDT 2007
https://bugzilla.novell.com/show_bug.cgi?id=335464
Summary: DataColumn.DateTimeMode does not correctly effect
DateTime stored in DataRow
Product: Mono: Class Libraries
Version: 1.2
Platform: i386
OS/Version: Windows Vista
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.Data
AssignedTo: anagappan at novell.com
ReportedBy: rlai at irismedia.com
QAContact: mono-bugs at ximian.com
Found By: ---
Description of Problem:
DataColumn.DateTimeMode does not correctly effect DateTime stored in DataRow
Steps to reproduce the problem:
DateTime utc = DateTime.UtcNow;
DateTime local = utc.ToLocalTime();
DataTable table = new DataTable("Test");
DataColumn column;
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_utc_datetime_local";
column.DateTimeMode = DataSetDateTime.Local;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_local_datetime_local";
column.DateTimeMode = DataSetDateTime.Local;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_utc_datetime_unspecified";
column.DateTimeMode = DataSetDateTime.Unspecified;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_local_datetime_unspecified";
column.DateTimeMode = DataSetDateTime.Unspecified;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_utc_datetime_unspecifiedlocal";
column.DateTimeMode = DataSetDateTime.UnspecifiedLocal;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_local_datetime_unspecifiedlocal";
column.DateTimeMode = DataSetDateTime.UnspecifiedLocal;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_utc_datetime_utc";
column.DateTimeMode = DataSetDateTime.Utc;
table.Columns.Add(column);
column = new DataColumn();
column.DataType = System.Type.GetType("System.DateTime");
column.ColumnName = "test_local_datetime_utc";
column.DateTimeMode = DataSetDateTime.Utc;
table.Columns.Add(column);
DataRow row;
row = table.NewRow();
row["test_utc_datetime_local"] = utc;
row["test_local_datetime_local"] = local;
row["test_utc_datetime_unspecified"] = utc;
row["test_local_datetime_unspecified"] = local;
row["test_utc_datetime_unspecifiedlocal"] = utc;
row["test_local_datetime_unspecifiedlocal"] = local;
row["test_utc_datetime_utc"] = utc;
row["test_local_datetime_utc"] = local;
table.Rows.Add(row);
Console.WriteLine(utc.ToString("o") + "[" + utc.Kind + "]");
Console.WriteLine(local.ToString("o") + "[" + local.Kind + "]");
Console.WriteLine(((DateTime)row["test_utc_datetime_local"]).ToString("o") +
"[" + ((DateTime)row["test_utc_datetime_local"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_local_datetime_local"]).ToString("o") +
"[" + ((DateTime)row["test_local_datetime_local"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_utc_datetime_unspecified"]).ToString("o")
+ "[" + ((DateTime)row["test_utc_datetime_unspecified"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_local_datetime_unspecified"]).ToString("o")
+ "[" + ((DateTime)row["test_local_datetime_unspecified"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_utc_datetime_unspecifiedlocal"]).ToString("o")
+ "[" + ((DateTime)row["test_utc_datetime_unspecifiedlocal"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_local_datetime_unspecifiedlocal"]).ToString("o")
+ "[" + ((DateTime)row["test_local_datetime_unspecifiedlocal"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_utc_datetime_utc"]).ToString("o") + "["
+ ((DateTime)row["test_utc_datetime_utc"]).Kind + "]");
Console.WriteLine(((DateTime)row["test_local_datetime_utc"]).ToString("o") +
"[" + ((DateTime)row["test_local_datetime_utc"]).Kind + "]");
DataSet dataSet = new DataSet();
dataSet.Tables.Add( table );
StringWriter writer = new StringWriter();
XmlSerializer ser = new XmlSerializer(typeof(DataSet));
ser.Serialize(writer, dataSet);
dataSet.Tables.Clear();
Console.WriteLine(writer.ToString());
Actual Results:
2007-10-20T05:43:28.9020000Z[Utc]
2007-10-19T22:43:28.9020000-07:00[Local]
2007-10-20T05:43:28.9020000Z[Utc]
2007-10-19T22:43:28.9020000-07:00[Local]
2007-10-20T05:43:28.9020000Z[Utc]
2007-10-19T22:43:28.9020000-07:00[Local]
2007-10-20T05:43:28.9020000Z[Utc]
2007-10-19T22:43:28.9020000-07:00[Local]
2007-10-20T05:43:28.9020000Z[Utc]
2007-10-19T22:43:28.9020000-07:00[Local]
<?xml version="1.0" encoding="utf-16"?>
<DataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Test">
<xs:complexType>
<xs:sequence>
<xs:element name="test_utc_datetime_local" type="xs:dateTime"
minOccurs="0" />
<xs:element name="test_local_datetime_local" type="xs:dateTime"
minOccurs="0" />
<xs:element name="test_utc_datetime_unspecified"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_unspecified"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_utc_datetime_unspecifiedlocal"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_unspecifiedlocal"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_utc_datetime_utc" type="xs:dateTime"
minOccurs="0" />
<xs:element name="test_local_datetime_utc" type="xs:dateTime"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet>
<Test diffgr:id="Test1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<test_utc_datetime_local>2007-10-20T05:43:28.902</test_utc_datetime_local>
<test_local_datetime_local>2007-10-19T22:43:28.902</test_local_datetime_local>
<test_utc_datetime_unspecified>2007-10-20T05:43:28.902</test_utc_datetime_unspecified>
<test_local_datetime_unspecified>2007-10-19T22:43:28.902</test_local_datetime_unspecified>
<test_utc_datetime_unspecifiedlocal>2007-10-20T05:43:28.902</test_utc_datetime_unspecifiedlocal>
<test_local_datetime_unspecifiedlocal>2007-10-19T22:43:28.902</test_local_datetime_unspecifiedlocal>
<test_utc_datetime_utc>2007-10-20T05:43:28.902</test_utc_datetime_utc>
<test_local_datetime_utc>2007-10-19T22:43:28.902</test_local_datetime_utc>
</Test>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
Expected Results:
2007-10-20T05:43:26.2939882Z[Utc]
2007-10-19T22:43:26.2939882-07:00[Local]
2007-10-19T22:43:26.2939882-07:00[Local]
2007-10-19T22:43:26.2939882-07:00[Local]
2007-10-20T05:43:26.2939882[Unspecified]
2007-10-19T22:43:26.2939882[Unspecified]
2007-10-20T05:43:26.2939882[Unspecified]
2007-10-19T22:43:26.2939882[Unspecified]
2007-10-20T05:43:26.2939882Z[Utc]
2007-10-20T05:43:26.2939882Z[Utc]
<?xml version="1.0" encoding="utf-16"?>
<DataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Test">
<xs:complexType>
<xs:sequence>
<xs:element name="test_utc_datetime_local"
msdata:DateTimeMode="Local" type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_local"
msdata:DateTimeMode="Local" type="xs:dateTime" minOccurs="0" />
<xs:element name="test_utc_datetime_unspecified"
msdata:DateTimeMode="Unspecified" type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_unspecified"
msdata:DateTimeMode="Unspecified" type="xs:dateTime" minOccurs="0" />
<xs:element name="test_utc_datetime_unspecifiedlocal"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_unspecifiedlocal"
type="xs:dateTime" minOccurs="0" />
<xs:element name="test_utc_datetime_utc"
msdata:DateTimeMode="Utc" type="xs:dateTime" minOccurs="0" />
<xs:element name="test_local_datetime_utc"
msdata:DateTimeMode="Utc" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet>
<Test diffgr:id="Test1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<test_utc_datetime_local>2007-10-19T22:43:26.2939882-07:00</test_utc_datetime_local>
<test_local_datetime_local>2007-10-19T22:43:26.2939882-07:00</test_local_datetime_local>
<test_utc_datetime_unspecified>2007-10-20T05:43:26.2939882</test_utc_datetime_unspecified>
<test_local_datetime_unspecified>2007-10-19T22:43:26.2939882</test_local_datetime_unspecified>
<test_utc_datetime_unspecifiedlocal>2007-10-20T05:43:26.2939882-07:00</test_utc_datetime_unspecifiedlocal>
<test_local_datetime_unspecifiedlocal>2007-10-19T22:43:26.2939882-07:00</test_local_datetime_unspecifiedlocal>
<test_utc_datetime_utc>2007-10-20T05:43:26.2939882Z</test_utc_datetime_utc>
<test_local_datetime_utc>2007-10-20T05:43:26.2939882Z</test_local_datetime_utc>
</Test>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
How often does this happen?
always
Additional Information:
seems to be a problem in linux also
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list