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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:14:00+00:00 2026-05-30T15:14:00+00:00

From my android smartphone application (made by myself) I send a request to a

  • 0

From my android smartphone application (made by myself) I send a request to a server in Denver to save my location and time. The TIMESTAMP it saves is Denver’s current time (9 hours difference from local time). Now after 16 hours from the last request I wrote in my php script

$query = "SELECT * FROM `tblLoc` WHERE datetime > (CURRENT_TIMESTAMP - 86400)";

so as if I wanted to show me past 24 hours….

THIS WAS MISTAKE!

$query = "SELECT * FROM `tblLoc` WHERE datetime > CURRENT_TIMESTAMP() - INTERVAL 24 HOUR";

in SQL 86400 != 24 HOUR!!!

  • 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-30T15:14:01+00:00Added an answer on May 30, 2026 at 3:14 pm

    You need to either change MySQL’s time zone instead of PHP’s, or change your query so that PHP provides the timestamp, like so:

    $query = "SELECT * FROM tblLoc WHERE dateTime > (". time() ." - 86400)";
    

    EDIT based on comment

    UTC_TIMESTAMP() might be a good way to go, but make sure you are inserting/updating based on this same timestamp as well, and not based on CURRENT_TIMESTAMP().

    UTC timestamp is based on GMT (Greenwich Mean Time) and is at GMT+0. Dallas is at GMT-6 and Asia/Jerusalem is at GMT+2. So UTC_TIMESTAMP() always means the current time in GMT timezone, regardless of what your current time zone setting is. CURRENT_TIMESTAMP() means the current time in your current timezone.

    HOWEVER your results may still not be quite right. They may just look right for the moment, but may be off by a couple hours. But if you are inserting and updating based on CURRENT_TIMESTAMP and then selecting based on UTC_TIMESTAMP your results will not be correct.

    I would suggest one of the following three solutions:

    1. Switch your server’s timezone to Asia/Jerusalem (make sure to restart MySQL to apply the change).
    2. Set the timezone at the beginning of each script using ‘SET time_zone = timezone;’.
    3. Make a TZ environment variable with the correct timezone so that MySQL sets that timezone as the default on startup (again, make sure to restart MySQL).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a server to send and recieve XMPP messages from Android clients running
I am currently trying to send some data from and Android application to a
I've successfully connected to XMPP server (from android XMPP client), and I can send
Send Text Messages (SMS) From Android When Near A Predefined Location... Ex. i enter
Q: How does Web Applications differ from SmartPhone Applications (Iphone, Windows Mobile, Android/Nexus Application)
I am trying sending data from android application (with emulator) to web server (a
I send data from Android via HTTP Post to a Server running PHP and
I'm trying to authenticate to a web server from an android class with the
I have an interesting problem being reported to me from an android application I
I want to Reading Color from Android Application. Here I have developed one Application,

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.