Using the following code I'm getting the output as mentioned below.
echo $date = new date('c', strtotime('2017-03-14T22:30:00.000Z'));
Current Output: 2017-03-15T04:30:00+06:00
Expected Output: 2017-03-15 10:30:00 AM
How could I do it using PHP?
Please try this:
echo $date = date('Y-m-d H:i:s A', strtotime('2017-03-14T22:30:00.000Z'));
2017-03-15 10:30:00 AM . My timezone is Asia/Dhaka. Can you please suggest me to make as I expected?I would suggest to use DateTime
$d = new DateTime('2017-03-14T22:30:00.000Z');
echo $d->format('Y-m-d H:m:s');
//2017-03-14 22:03:00
$d->setTimezone(new DateTimeZone('Asia/Dhaka'));
echo $d->format('Y-m-d H:m:s');
//2017-03-15 04:03:00
Also, it seems to me that Asia/Dhaka is in fact UTC+6 so what you are after would be 2017-03-15T04:30:00, not 2017-03-15T10:30:00 (here the offset would be 12 hours)?
date.timezone = "Asia/Dhaka"then restart php service