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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:49:37+00:00 2026-05-11T20:49:37+00:00

It appears there are many ways to approach date and time massaging in php.

  • 0

It appears there are many ways to approach date and time massaging in php. I usually am only every dealing with local time. Today, I need to work in UTC.

I am querying against an API, the data they give me about an arbitrary record is:
created: Thu, 18 Jun 2009 21:44:49 +0000
* Documented as ‘UTC record creation time’

utc_offset: -28800
* Difference between users re

I need to convert that to a simple string to show the user what time and date the data was submitted in their local time.

I believe, the above translates to, if in Calif. for example:
Thursday 18th of June 2009 02:44:49 PM

My goal is to get to a time value I can pass to date() for easy formatting in a “pretty” format.

Is it really as simple as converting the above created time to seconds from epoch, adding in the offset, and then passing that to date()? Any gothcha’s to look out for?

$created_time = 'Thu, 18 Jun 2009 21:44:49 +0000';
$utc_offset = -28800;
$seconds = strtotime($created_time);
$localized_time = $seconds + $utc_offset;

echo date(DATE_RFC822, $localized_time);

Thanks

  • 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-11T20:49:38+00:00Added an answer on May 11, 2026 at 8:49 pm

    PHP should do thing automatically for you. I can also HIGHLY recommend using the DateTime object instead.

    $dt = new DateTime($created_time);
    echo $dt->format(DATE_RFC2822);

    PHP’s date and time functions are timezone aware.. Make sure you’re on a recent version of PHP, because a lot of work has been done in improving these systems.

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

Sidebar

Ask A Question

Stats

  • Questions 113k
  • Answers 113k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm assuming you want to find employees that are in… May 11, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer Why would you particularly want to include the type in… May 11, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer Just add an exit; statement in the file where you… May 11, 2026 at 10:05 pm

Related Questions

When designing tables, I've developed a habit of having one column that is unique
As I see it, there are two ways to handle mouse events to draw
There are many methods you shouldn't call if you are not on the AWT
I have a big project that was first created in Borland C++ 6. We're
I'm in need of integrating a django application with a visually intuitive google-maps interface,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.