Dating dating dates

James was looking for a way to calculate the number of days which have passed since a certain date.

Rather than using mktime() and a loop, James can subtract the current timestamp from the timestamp of the date in question and divide that by the number of seconds in a day: Another usage could find itself in a class submitted by Kyle M Hall which aids in the creation of timestamps from the recent past for use with My SQL.

Note that some formatting options are different from My SQL.

For example using a 24 hour notation without leading zeros is the option '%G' in PHP but '%k' in My SQL.

"skip all Fridays and Saturdays but include Sundays") or to set up dates that should always be skipped (e.g.

"skip July 4th in any year, skip the first Monday in September in any year"). If you see the number 86400 in a date calculation, think very hard before deciding that it is correct. In many places, some days have only 82,800 seconds and some have 90,000. Assuming that now plus 86,400 seconds is equivalent to some time tomorrow can sometimes be wrong.

Monday-Friday, excluding holidays) between any two given dates.

I couldn't find a simple way to do that in PHP, so I threw this together.

( can produce different, and seemingly incorrect, results depending on your PHP version and your choice of 'w' or 'N' for the Numeric representation of the day of the week: Prior to PHP 5.6.23, this results in: Today is Sun , day 0 of this week.

substr((string)microtime(), 1, 6);that will give you: yyyy/mm/dd hh:ii:ss.uuuuuuhope this helps someone in need!

thanks all While this will work for the majority of years it will not work on years that are multiples of 100 but not multiples of 400 i.e.(2100).

Day 1 of next week is It's common for us to overthink the complexity of date/time calculations and underthink the power and flexibility of PHP's built-in functions.

Consider In order to define leap year you must considre not only that year can be divide by 4!

Search for dating dating dates:

dating dating dates-57dating dating dates-45

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “dating dating dates”