All conversions are done for your locale/time zone.
Someone may find this info of some use: Rules for calculating a leap year:1) If the year divides by 4, it is a leap year (1988, 1992, 1996 are leap years)2) Unless it divides by 100, in which case it isn't (1900 divides by 4, but was not a leap year)3) Unless it divides by 400, in which case it is actually a leap year afterall (So 2000 was a leap year).
In practical terms, to work out the number of days in X years, multiply X by 365.2425, rounding DOWN to the last whole number, should give you the number of days.
You can just copy the code and save it to a file on the site and include it anywhere you need to perform a function, or display a notice./* Code to show a message only for a certain time frame.
This is a simple include file that can be used to display a message on any pages that use it.
Simply us a standard include instruction to this file on the page/s where you want the notice to appear.
When debugging code that stores date/time values in a database, you may find yourself wanting to know the date/time that corresponds to a given unix timestamp, or the timestamp for a given date & time.
The following script will do the conversion either way.
If you give it a numeric timestamp, it will display the corresponding date and time.
If you give it a date and time (in almost any standard format), it will display the timestamp.
This date Diff() function can take in just about any timestamp, including UNIX timestamps and anything that is accepted by strtotime().
It returns an array with the ability to split the result a couple different ways.