May 23, 2010

PHP Date

1. How to find current date and time.
strftime(), getdate(), date()

2. How to find the difference of two dates.
You can find the difference of two dates by first converting both the dates into Unix timestamps using mktime() and then subtracting one from the other. The difference is the time in seconds elapsed.

3. How to validate a date.
checkdate()

4. How to set date timezone.
date_default_timezone_set()

5. How to generate unique ID.
microtime()

No comments:

Post a Comment