whitetiger
whitetiger

Reputation: 75

How to get today's date in a particular format in PHP?

What should I do, if I want to echo today's date from IST timezone? I want the date to be in a particular simple format, like ex. 10th Jul. 2021 / 7th Sep. 2021, etc. Is it possible? TBH I am a beginner in this field, so I am still learning stuff...

Any help would be appreciated! Thanks!

Upvotes: 1

Views: 20

Answers (1)

whitetiger
whitetiger

Reputation: 75

Update : I have solved my own question -

I built this code :

<?php
date_default_timezone_set('Asia/Calcutta');
echo date('jS F\, Y');
?>

And it worked out perfectly. I get my desired result - 10th July, 2021

Upvotes: 1

Related Questions