mdate([$datestr = ''[, $time = '']])
Parameters: |
|
---|---|
Returns: |
MySQL-formatted date |
Return type: |
string |
This function is identical to PHP’s date() function, except that it lets you use MySQL style date codes, where each code letter is preceded with a percent sign, e.g. %Y %m %d
The benefit of doing dates this way is that you don’t have to worry about escaping any characters that are not date codes, as you would normally have to do with the date()
function.
Example:
$datestring = 'Year: %Y Month: %m Day: %d - %h:%i %a'; $time = time(); echo mdate($datestring, $time);
If a timestamp is not included in the second parameter the current time will be used.
Please login to continue.