SQL date operations: Last 90 days, Get Date from DateTime…

I am continuing putting some common examples of operations for Microsoft SQL Server.
In addition to some of the Date related code snippets published before, there are few more today:

-- Last 90 days:
select DATEADD(day, -90, GETDATE())
-- Get Date portion of DateTime value
select DATEADD(d, 0, DATEDIFF(d, 0, getdate()))
This entry was posted in Fun stuff with SQL Server and tagged , , . Bookmark the permalink.

Leave a Reply

  • About

    From a junior developer through Sr Manager position, I was always interested in new technologies. Passionate speaker, IT junky, developer, architect, team lead, and development manager - many hats, one goal - making software better and being closer to people’s needs. For the most part I am using my blog as a scratch pad, writing small articles on things which I came across, was asked about more then once, and which would otherwise require additional research again and again.

  • Testimonials

    The greydragon theme is fantastic. It’s clean, stable and feature rich. It took me a while to decide to move to G3 but with a there like this one, I could no longer resist. Thanks!


    I’ve been using this [theme] since the start. It is by far the most attractive, feature packed and stable of the user-created skins for Gallery3.

  • Categories

%d bloggers like this: