-2

I have this php script

date('dS F Y', strtotime($dateVariable))

The result is this:

01st September 2014

but I need the result as this: 01st Sep 2014

in other words, I need not the full name of the month. is that possible please?

Anastasie Laurent
  • 847
  • 2
  • 11
  • 26

3 Answers3

2
date('dS M Y', strtotime($dateVariable))
XaxD
  • 1,277
  • 10
  • 24
2

Try as below

date('dS M Y', strtotime($dateVariable))
narendra
  • 1,268
  • 1
  • 7
  • 8
1

You can do it directly with the date function, using the 'M' mode.

http://php.net/manual/en/function.date.php

Alternatively, check out the function JDMonthName -- using mode 2 you can get the abbreviated month name.

http://php.net/manual/en/function.jdmonthname.php

Alternatively, check out the strftime function (much like printf) for formatting your date. The %b format gives the abbreviated month name.

http://php.net/manual/en/function.strftime.php

lowcrawler
  • 5,684
  • 7
  • 34
  • 52