substr((string)microtime(), 1, 6);that will give you: yyyy/mm/dd hh:ii:ss.uuuuuuhope this helps someone in need!
thanks all 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.
An example of this relates to a comment made by james at bandit-dot-co-dot-en-zed.
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.
Rather than the looping and fine tuning of a date, Kyle can use the raw UNIX timestamps (this is untested code): Most spreadsheet programs have a rather nice little built-in function called NETWORKDAYS to calculate the number of business days (i.e.
The valid range of a timestamp is typically from Fri, GMT to Tue, GMT.
(These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer).
However, before PHP 5.1.0 this range was limited from to on some systems (e.g. You can prevent a recognized character in the format string from being expanded by escaping it with a preceding backslash.
If the character with a backslash is already a special sequence, you may need to also escape the backslash. Note that you should escape any other characters, as any which currently have a special meaning will produce undesirable results, and other characters may be assigned meaning in future PHP versions.
When escaping, be sure to use single quotes to prevent characters like \n from becoming newlines.