Skip to content
Advertisement

Display date with ordinal suffix in PHP

I am currently displaying date in my php code like below

JavaScript

its giving me output like

Monday Mar 08 2021

Instead I want output like

Monday Mar 08th 2021

I have found function

JavaScript

on this answer

But I am not getting idea how I can use it with my date format. Let me know if anyone here can help me for do it.

Thanks a lot!

Advertisement

Answer

You can specify any character that you want:

JavaScript

But if you want to get 1st, 2nd, 3rd, 4th ... you should use:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement