Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8570739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:37:34+00:00 2026-06-11T18:37:34+00:00

I am trying to consume a web service which requires dates in UTC. So

  • 0

I am trying to consume a web service which requires dates in UTC. So I found:

private static string GetDate(DateTime DateTime)
{
    DateTime UtcDateTime = TimeZoneInfo.ConvertTimeToUtc(DateTime);
    return XmlConvert.ToString(UtcDateTime, XmlDateTimeSerializationMode.Utc);
}

If I do:

DateTime DT1 = new DateTime(2012, 3, 25);
DateTime DT2 = new DateTime(2012, 3, 26);
string s1 = GetDate(DT1);
string s2 = GetDate(DT2);

s1 contains:

2012-03-25T00:00:00Z

and s2 contains:

2012-03-25T23:00:00Z

Why does s2 not contain:

2012-03-26T00:00:00Z

? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:37:36+00:00Added an answer on June 11, 2026 at 6:37 pm

    The London time zone had a daylight saving transition on March 25th at 1am (local time), moving from UTC+0 to UTC+1. So local midnight on March 26th in the UK was exactly 2012-03-25 23:00:00 in UTC. That’s almost certainly the cause of the problem.

    You should work out what you really, really want the values to represent. Unfortunately DateTime isn’t very good on helping you out here in terms of clarity. You may want to consider using my Noda Time library – or if you don’t, at least document your code in similar concepts. (It sounds like you’re trying to transform a LocalDate into an Instant, and in order to do that, you need to work out which time zone you really mean.)

    It’s entirely possible that you may be able to get away with:

    DateTime DT1 = new DateTime(2012, 3, 25, 0, 0, 0, DateTimeKind.Utc);
    DateTime DT2 = new DateTime(2012, 3, 26, 0, 0, 0, DateTimeKind.Utc);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to consume a web service created in .NET which needs SOAP authentication.
I am trying to consume a web service on an Apache/PHP server for which
I am trying to consume a web service which returns a Java hash map,
I'm trying to consume an ASP.net Web service, and found a utility called WSDL2ObjC.
Im trying to consume a Java web-service, that uses a certificate. I could generate
I'm getting XSS errors when trying to consume a .NET web service and I'm
I'm trying to consume a SharePoint 2010 web service via Visual Studio 2010. I
I am trying to consume a .net web service, and get the following error
I'm trying to use WCF to consume a web service provided by a third-party's
I'm trying to consume a .Net Web Service using perl and SOAP Lite. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.