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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:57:48+00:00 2026-06-01T19:57:48+00:00

I store the dates in my database in DATETIME type, looking as: Y-m-d H:i:s

  • 0

I store the dates in my database in DATETIME type, looking as: Y-m-d H:i:s

What I want to achieve is to return the date from the database in the local time of the user. For example, if the user is in France, I will return his timezone. Is it possible to achieve this without storing the timezone of the user? Or if it is possible somehow else, and the storing format in the database needs to be changed, then I can do that. But, I am trying to achieve this without storing the user’s timezone.

  • 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-01T19:57:50+00:00Added an answer on June 1, 2026 at 7:57 pm

    Well, the only way I can think of doing it without asking the user for their timezone is this:

    <p>The time is: <span id="time" data="<?php echo strtotime($time_from_db); ?>"></span></p>
    <script type="text/javascript">
        (function () {
            var t = document.getElementById('time'), d = new Date();
            d.setTime(t.getAttribute("data"));
            t.innerHTML = d;
        })();
    </script>
    

    This passes the datetime as a timestamp, which JS then applies locale (including timezone) to.

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

Sidebar

Related Questions

I store datetime values in the database as sql float type (Converted from an
I have a database with DateTime fields that are currently stored in local time.
I store a date/time in my database that is UTC. I'm working to add
MySQL stores the date in my database (by default) as 'YYYY-MM-DD' The field type
I have data stored as below in an MS Access database: Date User 20090101
I have legacy DB that store dates that means no-date as 9999-21-31, The column
I store some dates in my NSMutableArray, I want to retrieve them and change
I have premiere_poland column in database table which is date type. /** @Column(type=date, nullable=TRUE)
i'm new to java. now i have a question: how to store a date/time
In my database I have a field date of type varchar where the date

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.