Changeset 27044 for branches/2.6/include/functions.inc.php
- Timestamp:
- Jan 29, 2014, 9:50:58 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/include/functions.inc.php
r26903 r27044 545 545 function str2DateTime($original, $format=null) 546 546 { 547 if ( !empty($format) && version_compare(PHP_VERSION, '5.3.0') >= 0 )// from known date format 547 if (empty($original)) 548 { 549 return false; 550 } 551 552 if (!empty($format) && version_compare(PHP_VERSION, '5.3.0') >= 0)// from known date format 548 553 { 549 554 return DateTime::createFromFormat('!'.$format, $original); // ! char to reset fields to UNIX epoch … … 554 559 if (empty($t)) // from timestamp 555 560 { 556 $date =new DateTime('@'.$original);561 return new DateTime('@'.$original); 557 562 } 558 563 else // from unknown date format (assuming something like Y-m-d H:i:s) … … 574 579 $date->setDate($ymdhms[0], $ymdhms[1], $ymdhms[2]); 575 580 $date->setTime($ymdhms[3], $ymdhms[4], $ymdhms[5]); 576 } 577 578 return $date; 581 return $date; 582 } 579 583 } 580 584 }
Note: See TracChangeset
for help on using the changeset viewer.