Geting year from date column (Basic Queswtion)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Geting year from date column (Basic Queswtion)

Post by pedrotuga »

How do i get a four digit number from a YYYY-MM-DD date stored in a database.

Whats the best way?

I am using a mysql db.

thx in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

YEAR(`column reference`)
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Post by pedrotuga »

lets see...


like

Year('date')

it gets the year from a date string right?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

that's what he said..
Post Reply