News Feed
Sections




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

DZone.com:
Date and time in PHP 5
December 01, 2010 @ 13:58:03

New on the Web Builder Zone today, there's an article about DateTime in PHP5 from Giorgio Sironi introducing you to this very handy built-in feature.

PHP has made some progress here as well, for example with the Standard Php Library and its interfaces. Though, the SPL is incomplete and oriented to performance more than to object-oriented programming: take a look at the SplStack and SplQueue implementation containing 20 different methods to get the idea. However a little gem is shipped with each PHP installation: the datetime extension, which contains the DateTime class and its siblings. Ideally, everything you can do with date_* functions, you can do it with this class.

He includes some code that shows the DateTime object in action as a part of a PHPUnit test case - adding days, subtracting months, date difference and its support of operator overloading. There's also mention of Doctrine's native support for the extension.

0 comments voice your opinion now!
datetime date time tutorial introduction


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: An Example Zend Framework Blog App - Part 3: A Simple Hello World Tutorial

WebProNews: Introduction To Regular Expressions In PHP

Christian Weiske's Blog: Working with .phar files

NetTuts.com: So You Want to Accept Credit Cards Online?

Rob Allen: Injecting dependencies into your ZF2 controllers


Community Events





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


interview community tips bugfix voicesoftheelephpant framework laravel podcast series zendserver introduction conference language threedevsandamaybe release api list code deployment symfony

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