Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract year from date

Status
Not open for further replies.

mplbm

Programmer
Feb 9, 2006
24
GB
How do you extract the year from a datetime field?


Thanks,

Mike
 
YEAR(datecolumn)

Or DATEPART(yy, datecolumn)

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Sorry, I meant how do you get the full date i.e. dd/mm/yyyy, removing just the time. How do I do this?
 
faq183-5842, tip #7.

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top