Here is date format function in PHP.
function formatMyDateNicely($strTimeString) {
return date('F j, y \a\t g:iA', strtotime($strTimeString));
}
It outputs a date akin to “April 23, 12 at 12:01PM”.
However, this function, which uses double quotes, does not work.
function formatMyDateNicely($strTimeString) {
return date("F j, y \a\t g:iA", strtotime($strTimeString));
}
This function outputs a date akin to “April 23, 12 a 12:01PM”.
Why does changing the type of quotes matter?
\tis a tab character. Single quotes inhibit interpretation of escape sequences.