-6

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

Community
  • 1
  • 1
user1958711
  • 11
  • 1
  • 3

3 Answers3

0

You can try this-

echo date('Y-m-d h-i-s');

It will give something like : "2013-01-09 01-16-26"

Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90
0

[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

demo date

echo_Me
  • 37,078
  • 5
  • 58
  • 78
0

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

웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91