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

Related Questions

There appears to be many packages for getting/formatting the current date, or finding out
Is there a well known / popular NSLog replacement/approach that many iPhone developers are
There appears to be many alternative Emacs auto completion mechanisms. Without an exhaustive search,
At some point earlier on it appears there were too many sql connections and
From the answers to this question it appears there's a file somewhere on our
In CruiseControl.NET there appears to be the same xsl stylesheets in the server directory
Is there an option to enable the drop down menu that appears when coding
Is there any way to convert the image so it appears as a gray
Is there an event that fires in vb.net just before a contextMenuStrip appears when
Although the question title appears a bit subjective I am sure there is not

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.