Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Need to find short months ie JAN, FEB, MAR

New Here ,
May 20, 2011 May 20, 2011

Copy link to clipboard

Copied

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?

TOPICS
Server side applications

Views

463
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2011 May 20, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 20, 2011 May 20, 2011

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines