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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:12:59+00:00 2026-06-15T01:12:59+00:00

I am working on a web app using .NET MVC 3 and SQL server

  • 0

I am working on a web app using .NET MVC 3 and SQL server 2008 (r2).

Anyway, I have a date time object and I want to convert it to user time. It is fairly trivial to convert right now to user time; I have some java script that will get me the users offset from UTC. And I know my date times offset to UTC.

What I realized yesterday, is that my user’s offsets will change, if they live in a pesky area of the world. And that would cause old dates and time to be wrong by some amount of time.

Now I know C# has some utilities to convert into a time zones time, but do they really handle all of the intricacies of daylights savings?

For example. If I have a time, 10-10-2001 8:00:00 how do I get that into pacific time? Or if i have 6-6-2004, how do i get that into pacific time?

Since the dates change for the roll overs, it is pretty complex, and I would like a general solution that does not require maintenance to set up date ranges for time zones.

I know this is a classic problem in CS, but I cannot find something that really answers my question 100%. From what I have seen: C# uses the current year’s daylights savings dates to change every years date times. Which could cause some mistakes.

Thank you so much for the help.

  • 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-15T01:13:00+00:00Added an answer on June 15, 2026 at 1:13 am

    Now I know C# has some utilities to convert into a time zones time, but do they really handle all of the intricacies of daylights savings?

    TimeZoneInfo does, yes1. (It’s part of the .NET framework, not part of C# – C# is just the language you happen to be using.) However, I don’t think that’s what you really want to do.

    Why are you storing the DateTime in the server’s time zone anyway? It would be more sensible to store it in UTC, in most cases. Aside from anything else, if your server is in a time zone which observes daylight saving time, you will end up with ambiguity for one hour per year, when the clock goes back. (The same local time occurs twice.)

    Once you’ve stored it as UTC, you should give it to your Javascript client as UTC too. While you say that you have “some java script that will get me the users offset from UTC” – that will depend on the exact instant in time. For example, as I’m in the UK, my offset is sometimes 0 and sometimes +1 hour. If you pass the UTC back to the client, that can work out the local time from that UTC time. Your server can’t, unless you can get an accurate representation of the time zone from the client to the server, which is generally a tricky thing to do.

    From what I have seen: C# uses the current year’s daylights savings dates to change every years date times.

    Again, C# itself isn’t relevant here. It’s not clear which part of the .NET framework you mean – TimeZone? TimeZoneInfo? DateTime? TimeZoneInfo has historical data, but only if you’re on an operating system version which supports it.


    1 Well, as far as you’re likely to care. It doesn’t have as much historical data as TZDB, and it has some very odd representations for Russia and Namibia, but it does generally have the idea of rules changing.

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

Sidebar

Related Questions

Using: ASP.NET 4, SQL 2008, C# I'm writing a web app for our projects
I am working on a web app using C# and asp.net I have been
We've been working with ASP.Net MVC2 based web app. We're using DataAnnotations for model
I have an iPad app that submits orders to an ASP.NET MVC web site
I'm trying to get an ASP.NET MVC app working... I should have known it
Background I have a page on my ASP.NET MVC web app for users to
We've been working with .Net v3.5 SP1 and MVC 2. Backend SQL Server 2005.
I'm currently working on a web app/game using C# and ASP.NET(3.5). However, I'm running
I'm using the jquery dialog in my ASP.net web app. Within it I have
I am working on an ASP .NET Mvc 3 App and have installed Ninject.Mvc3

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.