Example #1
0
 /**
  * Method for get the timestamp from YYYYmmddhhmmss and obtain a valid formatted date
  */
 public static function format_datetime($format, $time_to_format, $func_utc_return)
 {
     $timestamp = DateTime::obtain_timestamp($time_to_format);
     if ($timestamp) {
         $timeclass = new \DateTime(substr($time_to_format, 0, 8), new \DateTimeZone(DateTime::$timezone));
         $offset = $timeclass->getOffset();
         #$offset=date("Z", $timestamp);
         $timestamp = $func_utc_return($timestamp, $offset);
         # Return utc
         return date($format, $timestamp);
     } else {
         return false;
     }
 }