substr((string)microtime(), 1, 6);that will give you: yyyy/mm/dd hh:ii:ss.uuuuuuhope this helps someone in need! This is much more obvious on the "zero-padded" results, but it's worth repeating.
It replicates the functionality of Open Office's NETWORKDAYS function - you give it a start date, an end date, and an array of any holidays you want skipped, and it'll tell you the number of business days (inclusive of the start and end days! I've tested it pretty strenuously but date arithmetic is complicated and there's always the possibility I missed something, so please feel free to check my math.
The function could certainly be made much more powerful, to allow you to set different days to be ignored (e.g.
"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"). 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.
When using dynamically generated date formatting string, be careful to generate the correct options for either PHP or My SQL.
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 I've been flicking through the comments looking for some succinct date code and have noticed an alarming number of questions and over-burdened examples related to date mathematics.
The valid range of a timestamp is typically from Fri, GMT to Tue, GMT.