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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:05:08+00:00 2026-05-23T16:05:08+00:00

I am storing information in a database and setting my POCO’s property to DateTime.Now.

  • 0

I am storing information in a database and setting my POCO’s property to DateTime.Now.

When this value is displayed it is appearing as the PST time. I would like it to to display as GMT time.

Do I do something like this to display/store it or is there a better way?

TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("GMT");  
var GMTTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now, tz));

Also it needs to consider Daylight Savings as UK changes its clocks at different times in the year than USA:

UPDATE: I have found that in the TimeZone setting you can pass either GMT Standard Time or Greenwich Mean Time, the first taking into account DST

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

    Store it as UTC. It’s designed for universal timezone-independent time.

    DateTime currentUtcTime = DateTime.UtcNow;
    DateTime localTime = currentUtcTime.ToLocalTime();
    DateTime backToUtcAgain = localTime.ToUniversalTime();
    

    Whether a given DateTime is already UTC or local time is determined by DateTime.Kind. You have to keep this in mind when serializing/deserializing DateTime values (e.g from a database) because this information is often not stored and when you get your DateTime back, it will most of the time have the value DateTimeKind.Unspecified, which may cause issues with conversion methods. I just make sure to force DateTimeKind.Utc when I load something in from a persistent data store.

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

Sidebar

Related Questions

I'm dynamically storing information in the database depending on the request: // table, id
I am retrieving information from my database and storing it in a reader. The
I am storing information on the phone's contacts using a sqlite database. The fields
I've put together a simple database for storing information on awards and nominations. I've
I have an app with an SQLite database for storing information for a user's
I am trying to streamline a complex process of storing information in multiple tables
I'm building a WebApp in jsf 2.0 and it's about storing information and displaying
I have 2 tables - one storing user information (id, username, password) and the
Whats the recommended way for storing authentication information in iOS that could be easily
Storing credit card information securely and legally is very difficult and should not be

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.