| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public static function dateTimeConverter(string $date) |
||
| 11 | { |
||
| 12 | // 20180301T175029.000Z |
||
| 13 | |||
| 14 | $date = substr( $date, 0, strpos( $date, '.000Z' ) ); |
||
| 15 | |||
| 16 | // 20180301T175029 |
||
| 17 | |||
| 18 | $date = str_replace( 'T', '', $date); |
||
| 19 | |||
| 20 | // 20180301175029 |
||
| 21 | |||
| 22 | $year = substr( $date, 0, 4 ); |
||
| 23 | $month = substr( $date, 4, 2 ); |
||
| 24 | $day = substr( $date, 6, 2 ); |
||
| 25 | |||
| 26 | $hour = substr( $date, 8, 2 ); |
||
| 27 | $min = substr( $date, 10, 2 ); |
||
| 28 | $sec = substr( $date, 12, 2 ); |
||
| 29 | |||
| 30 | return new DateTime($year . $month . $day . $hour . $min . $sec, new DateTimeZone('UTC')); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |