This question already has an answer here:
- Convert date time string in PHP 2 answers
I have a variable as:
$date_time = 2016-11-08T14:22:08.240Z
now how can i extract time in the format as 14:22
from the given variable.
</div>
This question already has an answer here:
I have a variable as:
$date_time = 2016-11-08T14:22:08.240Z
now how can i extract time in the format as 14:22
from the given variable.
</div>
I think you need to set the time_zone. To get the appropriate time . try below code:
date_default_timezone_set("GMT");
$date_time = '2016-11-08T14:22:08.240Z';
echo date("H:i",strtotime($date_time));