Mudassar Zahid
Mudassar Zahid

Reputation: 305

How to convert the time gmt format?

Here i have a date entry as by default mysql

Input: '2017-03-9 06:27:28'

Output: '2017-03-9 11:27:28'

i want to convert this time using php in GMT +5 format please help me the function to solve this

Upvotes: 1

Views: 53

Answers (1)

Sahil Gulati
Sahil Gulati

Reputation: 15141

PHP code demo

$string=strtotime("2017-03-9 06:27:28"); //converting time to timestamp
$timestamp=strtotime("+5 hours",$string);//added zone time
echo date("Y-m-d H:i:s", $timestamp); //displaying new time

Upvotes: 2

Related Questions