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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:58:27+00:00 2026-05-12T15:58:27+00:00

I just got some tweets using their XML feed, and have gotten the date/times

  • 0

I just got some tweets using their XML feed, and have gotten the date/times like so

Tue Sep 29 22:30:51 +0000 2009

I tried using strtotime() on this, but it wasn’t producing the correct results.

I later on use

echo date($dateTimeFormat, $twitterUnixTime);

I know I could use a regex, but from the looks of it it will be complicated (and will need to use a callback, to convert ‘Sep’ to a numeral. From what I understand, strtotime() can easily do MySQL dates (2009-09-30 13:00:00) and some others (generally from RSS feeds).

What can I do here to get this date/time as an Unix Epoch time?

UPDATE

Here is my code

$dateTime = $status->created_at; // Tue Sep 29 22:30:51 +0000 2009

$date = strtotime($dateTime);

$dateTimeFormat = 'j/n/y g:ia';

echo date($dateTimeFormat, $date); // 2/2/09 12:01am

UPDATE

Sorry guys, entirely my fault. I have a variable mistyped. Thanks for your answers!

  • 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-12T15:58:28+00:00Added an answer on May 12, 2026 at 3:58 pm

    What is exactly the problem you are getting with strtotime ?

    Using this code :

    $str = 'Tue Sep 29 22:30:51 +0000 2009';
    $ts = strtotime($str);
    
    var_dump(date('Y-m-d H:i:s', $ts));
    

    I get this output :

    string '2009-09-30 00:30:51' (length=19)
    

    So, wrong by 2 hours — is that the kind of problem you have ?

    If yes, it might be a problem of timezone : I am in France, and there is a difference of 2 hours with GMT/UTC time.

    Changing locale with the date_default_timezone_set function (to set one that is in the GMT timezone), with this line before the previous ones :

    date_default_timezone_set('Europe/London');
    

    Gets this as output :

    string '2009-09-29 23:30:51' (length=19)
    

    Which kind of look like the desired result ?

    You might also change the date.timezone setting in php.ini ; but might have some other impacts, so not sure it’s that much of a good idea…

    Maybe you could use the “UTC” timezone, btw, like this :

    date_default_timezone_set('UTC');
    

    Considering what we are willing to get/mean, it might actually be a better idea…

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

Sidebar

Related Questions

I just got Delphi 2009 and have previously read some articles about modifications that
I just got a dedicated server from a hosting company, and for some reason,
I am just starting with C++ and got some problems in understanding how the
We just added an autoupdater in our software and got some bug report saying
Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen
I've got a simple asmx web service that just needs to log some information
Just got a question about generics, why doesn't this compile when using a generic
Just got a request from my boss for an application I'm working on. Basically
I just got through manually removing the bin\ and obj\ folders from around 30
I just got a shiny, brand-new Debian server handed to me by our Systems

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.