TapeGun007 Posted March 24, 2010 Share Posted March 24, 2010 I need an SQL command, well, like this: SELECT * FROM Calendar WHERE Cal_Date='$temp_date' Cal_Date is equal to xx/xx/2010, but I only want the 2010 to be compared to $temp_date, how can I do that? Link to comment https://forums.phpfreaks.com/topic/196377-stripping-year-from-the-date/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 24, 2010 Share Posted March 24, 2010 If your column is a DATE or DATETIME data type (it should be if it is not), just use the mysql YEAR() function - SELECT * FROM Calendar WHERE YEAR(Cal_Date)='$temp_date' Link to comment https://forums.phpfreaks.com/topic/196377-stripping-year-from-the-date/#findComment-1031085 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.