﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / Development  / Date Issue / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 02:38:14 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>If you want to see some more date calculations, look here:[b][url]http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/[/url][/b]</description><pubDate>Mon, 19 Nov 2012 00:38:19 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>Simple:[code="sql"]declare @ThisDate datetime;set @ThisDate = getdate();select @ThisDate, dateadd(qq, datediff(qq, 0, @ThisDate), -1);set @ThisDate = '20120507';select @ThisDate, dateadd(qq, datediff(qq, 0, @ThisDate), -1);[/code]</description><pubDate>Mon, 19 Nov 2012 00:37:15 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>hi, You can write a query likeselect Case When Month(getdate()) &amp;lt;=3 Then '31-03-'+ Convert(Varchar(4),Year(GetDate()))	When Month(getdate()) &amp;gt; 3 AND Month(getdate()) &amp;lt;=6 THEN '31-06-' + Convert(Varchar(4),Year(GetDate()))	When Month(getdate()) &amp;gt; 9 AND Month(getdate()) &amp;lt;=9 THEN '31-09-' + Convert(Varchar(4),Year(GetDate()))	ELSE '31-12-' + Convert(Varchar(4),Year(GetDate())) ENDthis will return you the expected result</description><pubDate>Mon, 19 Nov 2012 00:04:32 GMT</pubDate><dc:creator>Ajay.Kedar</dc:creator></item><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>Then I suggest you build a table which houses all the different probabilities</description><pubDate>Wed, 07 Nov 2012 04:25:28 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>Thanks,But the thing is it works for only current year and the input date can be last year date.for example input date '2010-07-06'(6th July 2010) then output should be 30.06.2010.</description><pubDate>Wed, 07 Nov 2012 04:15:55 GMT</pubDate><dc:creator>ningaraju.n</dc:creator></item><item><title>RE: Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>You need to do a condition where Date &amp;gt;= FromDate and Date &amp;lt;= ToDate[code="sql"]DECLARE @Table TABLE (FromDate DATETIME, ToDate DATETIME, ResultDate DATETIME)INSERT INTO @Table VALUES('2012-01-01','2012-03-31','2011-12-31'),('2012-04-01','2012-06-30','2012-03-31'),('2012-07-01','2012-09-30','2012-06-30'),('2012-10-01','2012-12-31','2012-09-30')SELECT	ResultDateFROM	@TableWHERE	GETDATE() &amp;gt;= FromDate	AND	GETDATE() &amp;lt;= ToDate[/code]</description><pubDate>Wed, 07 Nov 2012 03:44:41 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Date Issue</title><link>http://www.sqlservercentral.com/Forums/Topic1381858-145-1.aspx</link><description>I have a problem with datesProblem: There is a master  table which defines the date based on range as follows[sup][b][From][/b]					[b][To]	[/b]								[b][ResultDate][/b]'1st Jan'					'31st March	'							'31.12.YYYY-1''1st April'					'30th June'								'31.03.YYYY''1st July'					'30th Sep'								'30.06.YYYY''1st Oct'					'31st Dec'							        '30.09.YYYY'[/sup]If my input date is today's date then it should return 30.09.2012 as today is between [b]from[/b] and [b]to[/b] dates of the 4th row.If my input is '2012-05-07'(7th May 2012) then I should get 31.03.2012</description><pubDate>Wed, 07 Nov 2012 03:18:05 GMT</pubDate><dc:creator>ningaraju.n</dc:creator></item></channel></rss>