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

  • Home
  • SEARCH
  • 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 398555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:45:36+00:00 2026-05-12T16:45:36+00:00

I have to use some dates and times from a legacy database. They are

  • 0

I have to use some dates and times from a legacy database. They are represented as strings. Dates are dd/MM/yy. Times are HH:mm.

I’d like to convert these to UTC as soon as I pull them from the database. I’m working on US systems, so need a common time.

The problem I’m facing is how to convert them to UTC DateTime values. I can do the parsing, etc. The real problem I have concerns the timezone.

I’m trying to use the following approach:

DateTime ukTime = // Parse the strings in a DateTime value.
TimeZoneInfo timeZoneInformation = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
DateTimeOffset utcTime = new DateTimeOffset(ukTime, timeZoneInformation.BaseUtcOffset);

However, this gives incorrect values if the date is in the British Summer Time period.

I can use “GMT Daylight Time” on those dates, but that requires me to know when the switchover is. I’m sure there must be a less laborious way.

As I’m not using a machine with UK time settings I can’t rely on local time.

Basically, I need something like:

// Works for both GMT (UTC+0) and BST (UTC+1) regardless of the regional settings of the system it runs on.
DateTime ParseUkTimeAsUtcTime(string date, string time)
{
    ...
}

I’ve scoured the posts, but couldn’t find anything that addressed this directly. Surely this is also an issue with EST, EDT, etc?

  • 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-05-12T16:45:36+00:00Added an answer on May 12, 2026 at 4:45 pm

    Try using the GetUtcOffset() method on your TimeZoneInfo instance, which takes “adjustment rules” into consideration.

    Using this should work basically the same as your original example, but you’ll use that method instead of the BaseUtcOffset property.

    DateTime ukTime = // Parse the strings in a DateTime value.
    TimeZoneInfo timeZoneInformation = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
    DateTimeOffset utcTime = new DateTimeOffset(ukTime, timeZoneInformation.GetUtcOffset(ukTime));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want use some data from a website with web service. i have a
Why do i have to use some persistent-login module to make my users login
Often we have to use some of the methods which don't return anything useful.
I'm developing a XPCOM C++ component that have to use some RegExps functions Does
This question is hard to phrase, so I'm going to have to use some
I have tried to use some of the widgets in JQuery UI on an
I want all my pages to use have some viewdata. i need to get
I have a console application that require to use some code that need administrator
i have an issue i could use some help with, i have python list
I follow the tutorial here http://blog.bdoughan.com/2011/05/jaxb-and-joda-time-dates-and-times.html to use joda DateTime with jersey. But I

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.