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.

    View Serguei Dosyukov's profile on LinkedIn
  • Testimonials

    The greydragon theme is fantastic. It’s clean, stable and feature rich. It took me a while to decide to move...

    Ed

    I’m a huge fan of this theme. I’ve got more than 90,000 pictures in my gallery3 running on a Ubuntu...

    Jklobo

    I've been using this [theme] since the start. It is by far the most attractive, feature packed and stable of...

    Rhyull

    more...

  • Categories