piheshpi90 Posted February 14, 2011 Share Posted February 14, 2011 im trying to create sql that display data from current year.so im using datepart().but error says -->FUNCTION e_latihan.DATEPART does not exist. why it say like that.can anybody help me find a resolution? "SELECT * FROM aktiviti WHERE year(`tarikh_akhir`)=DATEPART(GETDATE()) OR year(`tarikh_awal`) = DATEPART(GETDATE()) "; Quote Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/ Share on other sites More sharing options...
Pikachu2000 Posted February 14, 2011 Share Posted February 14, 2011 DATEPART and GETDATE aren't MySQL functions. SELECT * FROM aktiviti WHERE YEAR(`tarikh_akhir`) = YEAR( CURDATE() ) OR YEAR(`tarikh_awal`) = YEAR( CURDATE() ) Quote Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173869 Share on other sites More sharing options...
piheshpi90 Posted February 14, 2011 Author Share Posted February 14, 2011 if i want to echo the current year..how to do that? Quote Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173875 Share on other sites More sharing options...
fenway Posted February 14, 2011 Share Posted February 14, 2011 That's already in there. Quote Link to comment https://forums.phpfreaks.com/topic/227580-get-current-year-problem/#findComment-1173889 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.