Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.27 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Convert data from email header
  2. $str = 'Wed, 28 Apr 2010 21:59:49 -0400';
  3. $date = DateTime::createFromFormat( 'D, d M Y H:i:s O', $str);
  4.        
  5. echo $date->getTimestamp(); // Outputs: 1272506389
  6. echo $date->format( 'Y-m-d H:i:s'); // For MySQL column, 2010-04-28 21:59:49