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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:16:20+00:00 2026-05-25T01:16:20+00:00

I want to parse the Twitter API created_at value(stored into a variable), which looks

  • 0

I want to parse the Twitter API created_at value(stored into a variable), which looks like this:

Sun Aug 28 19:31:16 +0000 2011

Into this:

19:31, Aug 28

But I need it to be timezone-aware. Any ideas about how to make this using php?


After using the second option which John Flatness suggested I’m getting this error:

Fatal error:  Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Sao_Paulo' for 'BRT/-3.0/no DST' instead' in /misc.php:4
Stack trace:
#0 /misc.php(4): DateTime->__construct('Sun Aug 28 19:3...')
#1 /tabs/home.php(29): format_date(Object(SimpleXMLElement), 'America/Sao_Pau...')
#2 {main}
  thrown in /misc.php on line 4
  • 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-25T01:16:21+00:00Added an answer on May 25, 2026 at 1:16 am

    If you set the timezone you want to output in with date_default_timezone_set (or the date.timezone INI setting), you can simply do:

    $formatted_date = date('H:i, M d', strtotime('Sun Aug 28 19:31:16 +0000 2011'));
    

    If you instead need to potentially output in many different time zones, it’s probably easier to use the new-style DateTime class:

    $date = new DateTime('Sun Aug 28 19:31:16 +0000 2011');
    $date->setTimezone(new DateTimeZone('America/New_York'));
    $formatted_date = $date->format('H:i, M d');
    

    Obviously the 'America/New_York' part would actually be a per-user setting for their timezone, not a literal string.

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

Sidebar

Related Questions

i want parse xml file, which does't have xml extension, like this: http://bizonek.wrzuta.pl/xml/plik/1ANdXCgTOit/unknow/undefined/643/ my
I want to parse this content using Javascript. The data looks like this: {ss:[[Thu,7:00,Final,,BAL,19,ATL,20,,,56808,,PRE4,2015],[Thu,7:00,Final,,NO,10,GB,38,,,56809,,PRE4,2015]]}
I want to parse a config file sorta thing, like so: [KEY:Value] [SUBKEY:SubValue] Now
I want to parse data which might contain mixed patterns like 1-4pm 1pm-5pm noon
I was following this tutorial on how to parse twitter search api requests with
I am developing Twitter API to my application. In my app, I want to
I want parse xml by looping through it. I referred this but I am
i want parse null value and disable checkbox in form view how can i
I have implemented ipad application in which i want parse table of content but
I get a longString from object's onclick value var longString = String(this.onclick); output like

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.