Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

How do I get the current date and time in PHP?

Which PHP function can return the current date/time?

Answer*

Cancel
8
  • 121
    The call to time() is redundant, date() will automatically use the current time. Commented Jan 23, 2009 at 0:26
  • 15
    OP never asked about timezone. A simpler and more correct answer would simply show server time. Commented Feb 21, 2014 at 16:38
  • 54
    @AyexeM I actually appreciated the additional timezone information. It saved me a second search.
    – M -
    Commented Oct 8, 2014 at 19:11
  • 7
    You can get all the time zone from here Time Zone Commented Jan 5, 2015 at 12:17
  • 18
    @AyexeM A simpler and more correct answer would not be to omit potentially important and related information, but instead to answer the question, as you suggest, but then provide additional information on timezones beneath it. There's no need to omit potentially crucial information just because it wasn't asked for.
    – Jamie
    Commented Feb 27, 2015 at 9:08