Ragith Thomas Ragith Thomas - 4 months ago 34
PHP Question

How to get current date and time in php

Thanks in advance. Actually i was using

date('Y-m-d h:i:s', time())
date("Y-m-d H:i:s")
to get the current date and time in php but it's not showing the proper time. Instead of showing proper Indian time it's showing some other time
My code is:

$today = date("Y-m-d H:i:s");
echo "Current date and time is ".$today;


Try this.

echo date("Y-m-d H:i:s"); // time in India