Link to home
Start Free TrialLog in
Avatar of Alex Lord
Alex Lord

asked on

Splitting string in php

 $getString = "2018-09-17T17:02:10.898Z";

Open in new window


im using php how can i use php to split this into like below


2018-09-17

17 hour
02 min
10 seconds

? struggling for hour with preg_mach
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you really want to split it like you suggest:

$parts = array_map('trim', explode('T',  $getString));
$date = $parts[0];
$hour_parts = array_map('trim', explode(':',  $parts[1]));
$hour = $hour_parts[0];
$minute = $hour_parts[1];
// blah blah - you get the idea?