Home arrow MySQL arrow Practical Date/Time examples with PHP and MySQL

Practical Date/Time examples with PHP and MySQL

In this article Mauricio shows us some examples of how to use the date/time features with MySQL and PHP including the UNIX timestamp and the PHP date_diff() function.

TABLE OF CONTENTS:
  1. Practical Date/Time examples with PHP and MySQL
  2. The UNIX timestamp
  3. How old are you? (exactly)
  4. Date Addition and Subtraction
  5. Conclusion
By: Mauricio Cuenca
Rating: starstarstarstarstar / 98
April 22, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Some time ago working with dates and times was a pain for me. In several of my projects I had to calculate a person's age based on their birth date. I created a members area that allowed the administrators to set the maximum amount of time users can have a password before they must change it and remind each one how many days left before the change. I also had to create time-bomb accounts that worked for several days after its creation and then became useless.

Digging into the PHP and MySQL documentation I found and then worked with several functions that made my life easier. Now I want to share some code tips that allow better manipulation of the time and date in your projects and everyday needs.

 
 
>>> More MySQL Articles          >>> More By Mauricio Cuenca
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...
- MySQL Left and Right Joins


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap

Dev Shed Tutorial Topics: