News Feed
Jobs Feed
Sections




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

PHPMaster.com:
Working with Dates and Times in PHP and MySQL
March 01, 2012 @ 08:51:47

On PHPMaster.com today there's a new tutorial by Sean Hudgston about working with dates and times via the PHP date functions and how they cooperate with dates/times from a MySQL database.

When working in any programming language, dealing with dates and time is often a trivial and simple task. That is, until time zones have to be supported. Fortunately, PHP has one of the most potent set of date/time tools that help you deal with all sorts of time-related issues: Unix timestamps, formatting dates for human consumption, displaying times with time zones, the difference between now and the second Tuesday of next month, etc. In this article I'll introduce you to the basics of PHP's time functions (time(), mktime(), and date()) and their object-oriented counterparts, and then take a look at MySQL dates and show you how to make them play nicely with PHP.

His examples include how to get the current Unix time, formatting dates/times, making timestamps and working with the more powerful DateTime objects. On the MySQL front, he shows the result of a normal date select, one using the "unix_timestamp" function and how to shift the result based on the user's timezone.

0 comments voice your opinion now!
date time mysql datetime tutorial format unix timestamp


blog comments powered by Disqus

Similar Posts

Northclick Blog: Tutorial for the easy use of gettext for internationalization of PHP Apps

99Points.info: Youtube Style Share Button With URL Shortening using CURL, jQuery and PHP

Ibuildings techPortal: Doing the Heavy Lifting: Gearman and Magento

PHPBuilder.com: 10 Easy Solutions for PHP String Manipulation

IBM developerWorks: MVC with Agavi - Add forms and database support with Agavi and Doctrine


Community Events











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


code security language install podcast component symfony2 opinion release composer hhvm unittest application overview framework introduction hack package facebook example

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