Store, expect, and return all your dates in Zulu (UTC) time with no time
zone. Your common tz is then 0. All calculations also done with UTC times.
Users of the data can then convert to local time if needed, etc.
public static string StoreDateTimeUtc(DateTime value)
{
// Date *must be UTC date already.
// e.g 2003-10-26T14:33:41.1234567Z
return value.ToString("yyyy-MM-ddTHH:mm:ssZ",
CultureInfo.InvariantCulture);
}
/// <summary>
/// Parses the UTC formatted string, returning DateTime in UTC.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static DateTime ReadDateTimeUtc(string value)
{
return DateTime.Parse(value, CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal);
}
--
William Stacey, MVP
http://mvp.support.microsoft.com
"JP" <JP@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
How do i remove the TZ from the date which I assume is the -06:00
<IssueDate>2005-01-12T00:00:00.0000000-06:00</IssueDate>
Liek I said un the phical SQL table, all thats there is the date and I
guess SQL assumes midnight even though its not displayed in the table itself.
"Dilip Krishnan" wrote:
Hello JP,
May be there is some time zone in the date thats getting changed
according to the machines timezone?
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
I have a WS that returns a dataset. When I serialize the data and
display in on the screen my dates always seem to be -1 or +1 of the
date I exspected.
1/11/2005 10:00:00 PM where should have returned 1/12/2005
However if I execute the WS directly the dates are correct.
<IssueDate>2005-01-12T00:00:00.0000000-06:00</IssueDate>
The field in SQL is a datetime field but only dates are stored (no
time)
Any seggestions or ideas as to why this is occuring
Thanks