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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:37:00+00:00 2026-06-03T17:37:00+00:00

I am using php, and mysql. When i insert a time value into mysql

  • 0

I am using php, and mysql. When i insert a time value into mysql database on my local host, the correct time is applied. i am using the now() function for the time.

When i insert the time values into my_sql database on my web-hosting account, it shows the wrong time zone.

if a user from a different time zone posts something, and i am viewing it in my time zone, how can i set it so the time displayed to the user is relative to where the user is viewing it from.

$sql1="INSERT INTO notifications (stamp) 
            VALUES (now());
  • 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-03T17:37:01+00:00Added an answer on June 3, 2026 at 5:37 pm

    Your server’s in a different time zone.

    You can set the timezone in PHP and in MySQL.

    date_default_timezone_set('America/Los_Angeles');
    

    And in MySQL:

    SET time_zone = 'America/Los_Angeles';
    

    Or, you can store your times as timestamp columns, which are always UTC in the underlying data.

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

Sidebar

Related Questions

I'm passing a large dataset into a MySQL table via PHP using insert commands
Simple php/mysql INSERT such as mysql_query(INSERT INTO dispatch VALUES('1234','$name','$address')); intermittently fails. I've set it
I'm using a mysql_query() in PHP to insert a value into a table in
I am trying to run a mysql insert query using php exec with parameters.
How can I insert an image in MySQL and then retrieve it using PHP?
I'm using PDO to insert a record (mysql and php) $stmt->bindParam(':field1', $field1, PDO::PARAM_STR); $stmt->bindParam(':field2',
I am using the Database Backup script by David Walsh( http://davidwalsh.name/backup-mysql-database-php ) to backup
I want to make a simple news system using PHP and MySQL, right now
I have a page where I get a date/time to insert into a MySQL
What's the right way of using a MySQL function while using PHP PDO? The

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.