<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>date manipulations Archives - Dragonsoft Technology View</title>
	<atom:link href="https://blog.dragonsoft.us/tag/date-manipulations/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.dragonsoft.us/tag/date-manipulations/</link>
	<description>Talk about Technologies, Software Architecture and Management</description>
	<lastBuildDate>Wed, 03 Jun 2009 14:46:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blog.dragonsoft.us/wp-content/uploads/2022/04/logo-main-bw-150x150.png</url>
	<title>date manipulations Archives - Dragonsoft Technology View</title>
	<link>https://blog.dragonsoft.us/tag/date-manipulations/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">2577970</site>	<item>
		<title>SQL date operations: Last 90 days, Get Date from DateTime&#8230;</title>
		<link>https://blog.dragonsoft.us/2008/05/12/sql-date-operations-last-90-days-get-date-from-datetime/</link>
					<comments>https://blog.dragonsoft.us/2008/05/12/sql-date-operations-last-90-days-get-date-from-datetime/#respond</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Mon, 12 May 2008 20:14:16 +0000</pubDate>
				<category><![CDATA[Fun stuff with SQL Server]]></category>
		<category><![CDATA[date manipulations]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=179</guid>

					<description><![CDATA[<p>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: Copyright &#169; 2026 Dragonsoft Technology View. This Feed is for personal non-commercial use only.</p>
<p>The post <a href="https://blog.dragonsoft.us/2008/05/12/sql-date-operations-last-90-days-get-date-from-datetime/">SQL date operations: Last 90 days, Get Date from DateTime&#8230;</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am continuing putting some common examples of operations for Microsoft SQL Server.<br />
In addition to some of the Date related code snippets <a href="http://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/" target="_self">published before</a>, there are few more today:</p>
<pre class="brush: sql; title: ; notranslate">-- Last 90 days:
select DATEADD(day, -90, GETDATE())
-- Get Date portion of DateTime value
select DATEADD(d, 0, DATEDIFF(d, 0, getdate()))
</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/05/12/sql-date-operations-last-90-days-get-date-from-datetime/">SQL date operations: Last 90 days, Get Date from DateTime&#8230;</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/05/12/sql-date-operations-last-90-days-get-date-from-datetime/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">179</post-id>	</item>
		<item>
		<title>SQL date operations: First day, Last day of the month&#8230;</title>
		<link>https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/</link>
					<comments>https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/#comments</comments>
		
		<dc:creator><![CDATA[Serguei Dosyukov]]></dc:creator>
		<pubDate>Tue, 05 Feb 2008 16:56:14 +0000</pubDate>
				<category><![CDATA[Fun stuff with SQL Server]]></category>
		<category><![CDATA[date manipulations]]></category>
		<category><![CDATA[piclens]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<guid isPermaLink="false">http://blog.dragonsoftru.com/2007/01/18/first-day-last-day-of-the-month-and-sql/</guid>

					<description><![CDATA[<p>Did you ever faced a situation when you need quickly calculate some boundaries of the Date value like First Day of the month, Last Day of the month, etc&#8230; in T-SQL? Colegue of mine asked me this question&#8230; WOW! What do you know&#8230; It is actually very easy if we think<a class="moretag" href="https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/"> Read more</a></p>
<p>The post <a href="https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/">SQL date operations: First day, Last day of the month&#8230;</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Did you ever faced a situation when you need quickly calculate some boundaries of the Date value like First Day of the month, Last Day of the month, etc&#8230; in T-SQL?</p>
<p>Colegue of mine asked me this question&#8230; WOW! What do you know&#8230;<br />
It is actually very easy if we think about it for a second&#8230;</p>
<p>So lets fun begin&#8230;</p>
<pre class="brush: sql; title: ; notranslate">--First Day of the Current Month:
select DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0)

-- Last Day of the Current Month:
select DATEADD(ms, -3, DATEADD(mm, DATEDIFF(m, 0, GETDATE()) + 1, 0))

-- Last Day of Prior Month:
select DATEADD(ms, -3, DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), 0))

-- First Day of the Current Year:
select DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0)

-- Last Day of the Current Year:
select DATEADD(ms, -3, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()) + 1, 0))

-- Last Day of Prior Year:
select DATEADD(ms, -3, DATEADD(yy, DATEDIFF(yy, 0, GETDATE()), 0))
</pre>
<p>And some more&#8230;</p>
<pre class="brush: sql; title: ; notranslate">-- First Day of the Quarter:
select DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0)

-- Monday of the Current Week:
select DATEADD(wk, DATEDIFF(wk, 0, GETDATE()), 0)

-- Midnight for the Current Day:
select DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)

-- First Monday of the Month:
select DATEADD(wk, DATEDIFF(wk, 0, DATEADD(dd, 6 - DATEPART(day, GETDATE()), GETDATE())), 0)

-- Last 2 full months
select DATEADD(ms, -3, DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) - 2, 0))
</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2026 <strong><a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a></strong>. This Feed is for personal non-commercial use only.</span><p>The post <a href="https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/">SQL date operations: First day, Last day of the month&#8230;</a> appeared first on <a href="https://blog.dragonsoft.us">Dragonsoft Technology View</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.dragonsoft.us/2008/02/05/first-day-last-day-of-the-month-and-sql/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">42</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Disk
Database Caching 22/83 queries in 0.033 seconds using Disk

Served from: blog.dragonsoft.us @ 2026-07-05 14:40:18 by W3 Total Cache
-->