What I have is a date that I'd like to format to keep it together on
one line using non-breaking spaces.
I started with:
date ("l F  ;j, Y", $unixtime);
and soon realized that the letters n and s are reserved characters for
the date command, so I did this:
$mydate =date ("l&\nb\sp;F&\n b\sp;j,&\nb\sp; Y", $unixtime);
The &, b, and p don't need to be escaped since they aren't listed as
being special characters for the date command. But no go. All it was
insert a new line in the middle to replace the \n and a space for the
\s. But as far as I can tell the space it inserts for the \s isn't
and html non-breaking space.
Then I tried:
$mydate =date ("l"." " . "F" . " ". "j," . " " . "Y",
$unixtime);
But the function does all of the string concatenation before it
substitutes the characters for the time information, so that doesn't
work either.
I know I can go through and use:
$mydate str_replace(" ", " ", $mydate);
but I thought there might be a better way. Surely there's some way to
tell date() that I want the character n, not the numeric
representation of the month and not a new line character.
Any ideas?
Thanks
one line using non-breaking spaces.
I started with:
date ("l F  ;j, Y", $unixtime);
and soon realized that the letters n and s are reserved characters for
the date command, so I did this:
$mydate =date ("l&\nb\sp;F&\n b\sp;j,&\nb\sp; Y", $unixtime);
The &, b, and p don't need to be escaped since they aren't listed as
being special characters for the date command. But no go. All it was
insert a new line in the middle to replace the \n and a space for the
\s. But as far as I can tell the space it inserts for the \s isn't
and html non-breaking space.
Then I tried:
$mydate =date ("l"." " . "F" . " ". "j," . " " . "Y",
$unixtime);
But the function does all of the string concatenation before it
substitutes the characters for the time information, so that doesn't
work either.
I know I can go through and use:
$mydate str_replace(" ", " ", $mydate);
but I thought there might be a better way. Surely there's some way to
tell date() that I want the character n, not the numeric
representation of the month and not a new line character.
Any ideas?
Thanks
Comment