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 6690169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:36:18+00:00 2026-05-26T05:36:18+00:00

All of our date/time data in our database is stored in UTC time. I’m

  • 0

All of our date/time data in our database is stored in UTC time. I’m trying to write a function to convert that UTC time into the user’s preferred time zone (they can select their timezone in their profile so it has NOTHING to do with local settings on their computer and everything to do with which timezone they have selected from a dropdown of available choices.

This function is in the context of a DevExpress AspxGridView event (the third party control is not relevant to the question but I thought I’d mention it):

DateTimeOffset utcTime = (DateTimeOffset)e.Value;

TimeZoneInfo destTimeZone = Helper.GetTimeZoneInfo();

DateTime modifiedDate = TimeZoneInfo
    .ConvertTimeFromUtc(utcTime.DateTime, destTimeZone);

e.DisplayText = String.Format("{0} {1}", 
                              modifiedDate.ToString("g"), 
                              destTimeZone.Abbreviation());

Helper.GetTimeZoneInfo() simply returns a TimeZoneInfo class that corresponds to the one the user selected, or defaults to “Pacific Standard Time” if they have not chosen one.

This generally works fine until I switch my system clock (which this server is running on) from today (which is Oct. 14, a DST date) to something like January 11, which is NOT DST.

The time seems to always be displayed in DST (i.e. always a 7 hour offset). No matter what I do with my system clock, I can’t get the time to adjust for the extra hour.

For example, when I have my timezone set to Pacific Standard Time, for UTC time 10-10-2011 20:00:00, it is always displaying this time:

10-10-2011 13:00:00 (the DST time, offset of -7).

During non-Daylight Savings dates (standard), the time should be:

10-10-2011 12:00:00 (offset of -8).

What am I missing?

  • 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-26T05:36:19+00:00Added an answer on May 26, 2026 at 5:36 am

    The converted local time of a UTC time is always based on the time zone info for that UTC time… not for whatever the current time happens to be.

    That is, the PST offset on Oct 10, 2011 UTC is always -7. It doesn’t matter what date you are doing the conversion on.

    …Or am I misunderstanding what you are asking?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our DBA requires us to return all tabular data from stored procedures in a
I've got to write a horrible interface to import data into a new database
It has recently been mentioned to be that our method of inserting data into
when we write all our application methods and variables in a classes is nothing
We want to encrypt all our web app configuration files that we deploy to
I have a profile weblog that contains all our users details (fields seperate from
We have a Library Project that we use for all our central reused code
Currently we got a web service up and running that handles all our C.R.U.D
I'm trying to display all the mailboxes and their sizes for all our users
Currently our database is set up so that a payment transactions records a payment

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.