开发者

Convert a time string eg "Wed, 24 Nov 2010 13:10:00 EST" to DataTime in PHP

I am parsing a xml, and I get the created time as: Wed, 24 Nov 2010 13:10:00 EST

My requirement is to convert this time开发者_如何学JAVA into the specified time format using DateTime function before inserting it in the database.

Can anyone help me with this.

Thanks you Zeeshan


  1. set EST timezone

    date_default_timezone_set('America/New_York');
    
  2. convert to epoch

    $epoch = strtotime('Wed, 24 Nov 2010 13:10:00 EST');
    
  3. get date/time

    echo date('Y-m-d H:i:s', $epoch); 
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜