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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:32:22+00:00 2026-06-08T18:32:22+00:00

I receive 12 hour time format from GPS tracker . example , GPS time

  • 0

I receive 12 hour time format from GPS tracker .
example , GPS time : 8:25:40 in GMT0 (in 12hour format)
GPS sent this time with a delay may be in range of 1~20 minute

receive time from GPS with 00:2:15 delay on 2012-07-27 23:27:55 with Europe/Moscow timezone

P.S: on above data , result of my GPS time must be 2012-07-27 23:25:40

Question:
How can I specify GPS time in my Timezone (Europe/Moscow) ?

  • 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-08T18:32:23+00:00Added an answer on June 8, 2026 at 6:32 pm
    $gps_time      = "9:43:52";
    $time_received = "01:45:04 2012-07-28";
    
    $utc    = new DateTimeZone("UTC");
    $moscow = new DateTimeZone("Europe/Moscow");
    
    //Instantiate both AM and PM versions of your time
    $gps_time_am = new DateTime("$gps_time AM", $utc);
    $gps_time_pm = new DateTime("$gps_time PM", $utc);
    
    //Received time
    $time_received = new DateTime($time_received, $moscow);
    
    //Change timezone to Moscow
    $gps_time_am->setTimezone($moscow);
    $gps_time_pm->setTimezone($moscow);
    
    //Check the difference in hours. If it's less than 1 hour difference, it's the correct one.
    if ($time_received->diff($gps_time_pm)->h < 1) {
        echo $gps_time_pm->format("H:i:s Y-m-d");
    }
    else {
        echo $gps_time_am->format("H:i:s Y-m-d");
    }
    

    Make sure to specify the exact date of the received time to prevent oddities.

    P.S. Moscow is in Europe.

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

Sidebar

Related Questions

I receive Date and time from CSV file The received Date format is YYYYMMDD
I get the Error sometime on Converting 12hour format time from a Timezone to
I receive a date in the format below from a json file. Im not
Is there any way i could convert a 12hour time format into a 24
I receive this error when I click on the section of my Tab-Bar application
I receive messages from a Google Talk account, they are shown in the Table
I receive a string from a database query, then I remove all HTML tags,
In a part of my system, I have this situation: I will receive a
A user visits my website at time t , and they may or may
I receive more than 1 million rows per hour, I need a way to

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.