What I did, it was to use DateTime.SpecifyKind method, as following:
DateTime dateTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified);
And this resolve my problem, I hope this help you.
More Related Contents:
- DateTime vs DateTimeOffset
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- Creating a DateTime in a specific Time Zone in c#
- datetime to string with time zone
- Convert UTC DateTime to another Time Zone
- compare the month part with linq [closed]
- Convert a string to date format
- Convert UTC/GMT time to local time
- How can I convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?
- Omitting all xsi and xsd namespaces when serializing an object in .NET?
- Stopwatch vs. using System.DateTime.Now for timing events [duplicate]
- Can I make XmlSerializer ignore the namespace on deserialization?
- Deserializing into a List without a container element in XML
- Entity Framework DateTime and UTC
- Linq to EntityFramework DateTime
- Why can’t DateTime.ParseExact() parse the AM/PM in “4/4/2010 4:20:00 PM” using “M’/’d’/’yyyy H’:’mm’:’ss’ ‘tt”
- Getting Date or Time only from a DateTime Object
- How can I convert a DateTime to the number of seconds since 1970?
- C# Datetimes: Conversion for different time zones
- Suppress Null Value Types from Being Emitted by XmlSerializer
- FileMode.Open and FileMode.OpenOrCreate difference when file exists? c# bug?
- Generating XML file using XSD file
- How to convert DateTime in Specific timezone?
- Cannot serialize member…. because it is an interface
- XmlSerializer Performance Issue when Specifying XmlRootAttribute
- Using XmlSerializer with an array in the root element
- Add hours or minutes to the current time
- .NET: Why is TryParseExact failing on Hmm and Hmmss?
- Convert string to datetime Using C#
- How can I parse dates with a suffix “th”, “st” or “nd” on the day of the month?