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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:25:23+00:00 2026-05-24T09:25:23+00:00

Using C#, I need to convert incoming datetime values into UTC. I know there

  • 0

Using C#, I need to convert incoming datetime values into UTC. I know there is functionality in .NET for these conversions but all I have to identify the timezone is the standard timezone list

http://www.timegenie.com/timezones

What’s the best way to do this in .NET? Will I need to create a mapping table to convert the timezones to the IDs in TimeZoneInfo.GetSystemTimeZones() (e.g. “Pacific Standard Time (Mexico)”)
so that I can then use TimeZoneInfo.FindSystemTimeZoneById()?

Thanks for any 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-05-24T09:25:23+00:00Added an answer on May 24, 2026 at 9:25 am

    I’ve done it before by storing the timezone id in the database using a mapping table. i.e. A table containing the results of TimeZone.GetSystemTimeZones()

    You don’t actually need to use TimeZoneInfo.FindSystemTimeZoneById() though: you can do the conversion using one of the overloads of TimeZoneInfo.ConvertTimeBySystemTimeZoneId(). This method has some overloads which take DateTime values, and some that take DateTimeOffset values (which are preferable as they specify an unambiguous point in time).

    e.g.

    TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "New Zealand Standard Time", "UTC")
    

    The real benefit of using the system time zone id rather than an offset stored in the database is that daylight savings time is automatically handled for you by TimeZoneInfo.ConvertTimeBySystemTimeZoneId.

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

Sidebar

Related Questions

I need to convert a char array into int and float using C The
I need to convert strings with optional trailing signs into actual numbers using Powershell.
For example, I rarely need: using System.Text; but it's always there by default. I
I need to convert an integer into a base64-character representation. I'm using OxA3's answer
I need to convert all text to lowercase, but not using the traditional tr
I need to convert a flat file to DB using MS SSIS. I need
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I need to convert a binary file (a zip file) into hexadecimal representation, to
I need to record a user's name that is using an ASP.NET web service.
I need to convert a date from this format: 2002-10-10T12:00:00-05:00 (xs:dateTime as defined in

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.