Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply CSS to PHP Date function

Tags:

date

css

php

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?

like image 782
GGio Avatar asked Dec 15 '22 11:12

GGio


1 Answers

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.

like image 187
Marc B Avatar answered Dec 30 '22 23:12

Marc B