Get a date part from a datetime type value in MS SQL Server.

Girl fuck Microsoft

Fuck  Microsoft, don’t know why they make this job “get the date/month/year part from a datime value” become so complicate. In MySQL just use Date(datetime_value) but here we go with Microsoft SQL (work with SQL 2008 and higher)


For example, get the today date from field PostTime has data type datetime you should go:

SELECT * FROM DB_NAME WHERE Convert(Varchar(10), PostTime,111)=’2015/04/07′

This is working method, there is another way with DATEADD(), DATEDIFF() and people said that method give better performance but I don’t want to give a fuck, I wan’t something sort and work.

Finally, fuck Microsoft as usual!

Pee on Microsoft sign


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s