Skip to main content
LouieCypher
Known Participant
May 20, 2011
Question

Need to find short months ie JAN, FEB, MAR

  • May 20, 2011
  • 1 reply
  • 487 views

Hi

Just a little problem:

I have the following query:

SELECT MONTHNAME(year) AS Month

FROM features1

which return the Month as JANUARY

I would like to get a shorter version of the month ie JAN

any ideas?

This topic has been closed for replies.

1 reply

LouieCypher
Known Participant
May 20, 2011

Think I just figured it out:

SELECT LEFT(MONTHNAME(year),3) AS Month,

FROM features1

Using LEFT: Returns the leftmost number of characters as specified by the amount (in this case 3)

Woot

May 20, 2011

echo substr($query_row['Month'], 0, 3);