Khurram Ijaz
Khurram Ijaz

Reputation: 1864

Simple way of getting the date

I have date in this format: 2010-01-11. I want to display JAN-11. How can i do this using php?

Upvotes: 1

Views: 170

Answers (2)

fedmich
fedmich

Reputation: 5381

Rudu's answer is correct, +1.

"M-y" would result to "Jan-11" so if you need the output to be UPPERCASE, dont forget to use strtoupper().

<?php echo strtoupper(date("M-y",strtotime("2010-01-11")));?>

also bookmark this for later reference. http://www.php.net/manual/en/function.date.php

Cheers

Upvotes: 1

Rudu
Rudu

Reputation: 15892

<?php echo date("M-y",strtotime("2010-01-11"));?>

Upvotes: 6

Related Questions