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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:37:16+00:00 2026-06-12T05:37:16+00:00

I have a mobile app and rest service. The mobile app will generate and

  • 0

I have a mobile app and rest service. The mobile app will generate and provide the web service a UTC date time and time zone. I need to store both values into mysql using php.

I am acquiring the date time from a remote source, so I cannot use mysql’s UTC_TIMESTAMP() to generate the ‘current’ utc time.

I have a table with 2 columns, created (DATETIME) and timezone (VARCHAR)

In PHP, I will collect the following:

$created = "2010-09-30 12:31:10"; //Actual UTC time
$timezone = "America/Los_Angeles"

How would the INSERT statement be so it stores $created, as is (UTC), without it storing it as my server’s default timezone?

Would I have to convert it from UTC to my server’s local time in PHP or can it be side stepped some how in MySQL?

  • 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-12T05:37:17+00:00Added an answer on June 12, 2026 at 5:37 am

    As far as I know, MySQL doesn’t support time zone information on date columns, like for instance, PostgreSQL do.

    Why can’t you just store the date as is? I’m fairly sure that no conversion will take place. And also, why do you need the timezone info anyway? Isn’t it more relevant to convert it to local time upon display, later on? For the specific user that is viewing the information?

    “The current time zone setting does not affect values displayed by functions such as UTC_TIMESTAMP() or values in DATE, TIME, or DATETIME columns. Nor are values in those data types stored in UTC; the time zone applies for them only when converting from TIMESTAMP values. If you want locale-specific arithmetic for DATE, TIME, or DATETIME values, convert them to UTC, perform the arithmetic, and then convert back. ” source https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html

    Meaning, MySQL only utilize the time zone information in order to return local time from TIMESTAMP() and similar functions, not for on the fly conversion of data inserted or selected.

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

Sidebar

Related Questions

I have a jquery mobile web app. On my iPhone when I am on
I am working on Rest web services and producing JSON data for mobile app.I
I have a mobile app where I need try and predictably guess which residential
I have a mobile app created in phongap (=html+javascript) and I need to encrypt
I have a mobile app that is using LinqToDatasets to update/insert into a SQL
I have a mobile app webservice client that connects to a WCF webservice(on my
I have a windows mobile app (mymobiler) that i am trying to install and
I have a Window Mobile app where the forms use keypreview and post the
I have a full Jquery Mobile app the currently builds and looks fine in
I have to make a mobile app that calculates the real life size of

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.