Datepart

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
btpwebdev
Forum Newbie
Posts: 5
Joined: Fri Apr 07, 2006 3:45 pm

Datepart

Post by btpwebdev »

Hi,
I have a date system whereby my date comes from a mysql database such as '2006-01-04'. Is it possible to take only that date from the database; eg: so i can turn the year into a variable.


Chris.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

You can SELECT YEAR(datefield) instead of the datefield in your query...
Post Reply