Fix for Empty DateTime Object

jwilson3's picture
  1. <?php
  2.  
  3. // Put this code in a new file (eg date.php) in your drupal root.
  4.  
  5. $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
  6. require_once './includes/bootstrap.inc';
  7. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  8.  
  9. $date = date_make_date('2008-03-08T10:24:00', 'UTC', DATE_ISO);
  10. print_r ($date);
  11.  
  12. $unix = date_convert('2008-03-09T10:24:00', DATE_DATETIME, DATE_UNIX);
  13. $datetime = date_convert($unix, DATE_UNIX, DATE_DATETIME);
  14. print_r ($unix); print "\n";
  15. print ($datetime);

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.