I'm right now creating View and I need to display only the YEAR from a normal DateTime
How can I do that to return just a Year as a value from ?
I have already tried it with EXTRACT but somehow it not working ..
Thanks for help and fast answer
Use YEAR()
function
SELECT YEAR(MyDateCol) FROM MyTable
You can use DATEPART() to extract the year from datetime value.
DATEPART(YEAR,GETDATE());
Check out SQLFIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With