Reputation: 7653
This might sound weird and might be very simple but my mind just isn't thinking properly right now.
I'm displaying the date with following format using PHP Date function
date('l, F jS Y, time());
Displays: Wednesday, April 10th 2013
How do I make th somehow a superscript without trying to extract the th from the returned string and applying CSS to it?
Upvotes: 4
Views: 1741
Reputation: 5191
Yes it's possible.
<?php
echo date('l F j\<\s\u\p\ \s\t\y\l\e\=\c\o\l\o\r\:\r\e\d\;\> S\<\/\s\u\p\> Y', time());
?>
DEMO: HERE
Upvotes: 1
Reputation: 7715
I would prefer this over concatenation and several date()
calls...
date('l, F j\<\s\u\p\>S\<\/\s\u\p\> Y', time());
Upvotes: 4
Reputation: 360602
you can split it into multiple parts:
$formatted = date('l, F j') . '<sup>' . date('S') . '</sup> ' . date('Y');
It's not particularly efficient, calling date so many times, but it's somewhat more reliable than a string operation.
Upvotes: 7