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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:20:23+00:00 2026-05-27T22:20:23+00:00

On my server I store the UTC time in the database for certain actions

  • 0

On my server I store the UTC time in the database for certain actions the user does. I want to convert that to local time for the user when they view the web page.

I could certainly do this with the utc time:

function setlocalTime($utc) {
  $timezone_offset = -5; //us east
  $recording_date = date('Y-m-d g:i A',strtotime($utc)+$timezone_offset*60*60);
  return $recording_date;
}

Obviously this is just for my timezone. What is the best way to do this for everyone’s timezone. Do I need to create a timezone library or is there a better way to convert my UTC time to the users local time?

  • 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-27T22:20:24+00:00Added an answer on May 27, 2026 at 10:20 pm

    PHP has a means of converting, but the thing that you have to really pay attention to is making sure you understand what the local timezone is. You probably want to find some way to get this from the browser (googling might help here).

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

Sidebar

Related Questions

We store all our dates SQL Server 2008 database in UTC time in DateTime
We have a WinForms application that uses SQL server to store its data. To
I have lots of article store in MS SQL server 2005 database in a
I want to store a a c# DateTimeOffset value in a SQL Server 2005
I am using UTC to store data and time values in the DB. The
I store dates on server side in UTC timezone. When client (browser) wants to
I'm using SQL Server to store several bits of information about each user. Some
I have an application in Asp.net and using sql server to store user information.
We have built an desktop(windows) application that needs SQL Server to store the data.
We have an ASP.NET application that uses SQL Server to store its session state.

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.