substr((string)microtime(), 1, 6);that will give you: yyyy/mm/dd hh:ii:ss.uuuuuuhope this helps someone in need!thanks all 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."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.Rather than the looping and fine tuning of a date, Kyle can use the raw UNIX timestamps (this is untested code): 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).A function not using php's date() function that will also account for this small anomaly in leap years: While is_leapyear_working will not return true for the few non-leap years divisible by four I couldn't tell you if this is more or less efficient than using php's date() as an even earlier poster suggested: Thanks to tcasparr at gmail dot com for the great idea (at least for me) ;)I changed the code a little to replicate the functionality of date_parse_from_format, once I don't have PHP 5.3.0 yet. Hope you don't mind changing your code tcasparr at gmail dot com./******************************************************* * Simple function to take in a date format and return array of associated * formats for each date element * * @return array * @param string $str Format * * Example: Y/m/d g:i:s becomes * Array * ( * [year] = The following function will return the date (on the Gregorian calendar) for Orthodox Easter (Pascha).Consider Since PHP 5.6.23 en 7.0.8 the support for requesting the weeknumber for a given date, where the first day of the week is Sunday, has been removed.
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.
This is very good for SEO especially search engines like Google .
Prior to PHP 5.6.23, Relative Formats for the start of the week aligned with PHP's (0=Sunday,6=Saturday).
The UNIX timestamp was built for this kind of work.
An example of this relates to a comment made by james at bandit-dot-co-dot-en-zed.
When using dynamically generated date formatting string, be careful to generate the correct options for either PHP or My SQL.$now will return the same (the server's current) Unix time stamp regardless which timezone your user is in. This is sure that the information you shared is clearly identive and fabulous for keeping it in minds.