Possible Duplicate:
Get current date and time in PHP
Which function in php can return the curretn date?
so that it takes time which should be in users country there should not be any default time
Possible Duplicate:
Get current date and time in PHP
Which function in php can return the curretn date?
so that it takes time which should be in users country there should not be any default time
You can try this-
echo date('Y-m-d h-i-s');
It will give something like : "2013-01-09 01-16-26"
[a] strftime(): Format a local time/date according to locale settings
[b] date : Format a local time/date
<?php
print date('r');
print "\\n";
print date('D, d M Y H:i:s T');
print "\\n";
?>
Output:
Mon, 23 Apr 2007 01:29:56 +0530
Mon, 23 Apr 2007 01:35:14 IST
and
<?php
print strftime('%c');
?>
Output:
Mon Apr 23 01:22:58 2007
First you need to set the time zone using date_default_timezone_set()
function in php
Then you need to get the date where ever you need using date()
function. Thats all..
date_default_timezone_set('Asia/kolkata');
echo date('Y-m-d H:i:s');
This will give you something like this
2013-01-09 19:15:48