Ragith Thomas Ragith Thomas - 1 year ago 95
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;

Answer Source

Try this.

echo date("Y-m-d H:i:s"); // time in India
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download