Monday, 11 April 2011

Removing Time from datetime

Following on my trend of date manipulations, another simple but useful bit of code is the following:

select convert(datetime, convert(char, <your date field here>, 106))
from <your table here>

This will strip the time out of your date, leaving with something you can aggregate to form daily reports or whatever you may need it for

T



No comments:

Post a Comment