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? Quote 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' Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.