News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ibuildings techPortal:
Tips for PHP Date and Time Functions
January 26, 2010 @ 10:06:57

In this new post from the Ibuildings techPortal today Michael shares some handy tips for working the date and time functions in PHP (all can be used in a non-PHP 5.3 installation).

His tips for these very handy functions include:

  • A Unix timestamp is never timezone-specific; if you call time() at the same moment on computers in different time zones, you get exactly the same value back.
  • The time string is interpreted as a local time; there is no gm- equivalent [of strptime], or even any way to simulate one, since it ignores the value of date_default_timezone_set. Note that you can impose a timezone on the input string if it contains a timezone abbreviation or offset.
  • [With date/gmdate] as with strftime/gmstrftime, the gm- prefix affects whether the result is a representation of the time in the current timezone or in the UTC timezone.
  • How does PHP know what your current timezone is? It tries a few different places, including the TZ environment variable and the date.timezone ini option.
1 comment voice your opinion now!
date time tip feature


blog comments powered by Disqus

Similar Posts

CatsWhoCode.com: 15 PHP regular expressions for web developers

XPertDeveloper.com: Is Your PHP Application Affected by the Y2K38?

PHP-GTK Community Site: PHP-GTK 2 Beta !

Hasin Hayder's Blog: Getting comfy with PhpStorm - one of the best IDEs so far!

Zend Developer Zone: Zend Framework 1.5.0 Preview Release now available


Community Events





Don't see your event here?
Let us know!


api library interview voicesoftheelephpant tips podcast list deployment symfony opinion language series bugfix laravel community package release framework introduction install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework