﻿<?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 2008 / SQL Server Newbies  / Computing First paydate of quarter / 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>Thu, 20 Jun 2013 01:49:40 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>option: add it to a calendar table, logging which days are paydates. Similar stuff: [url]http://jasonbrimhall.info/?p=193[/url]</description><pubDate>Mon, 25 Jan 2010 15:26:02 GMT</pubDate><dc:creator>jcrawf02</dc:creator></item><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>Thanks Michael, That did the trick. I edited your code to:select dateadd(dd,(datediff(dd,'1/1/2010',dateadd(dd,13,         dateadd(qq,datediff(qq,'1/1/2010',getdate()),'1/1/2010')))/14)*14,'1/1/2010') and that worked perfectly. I don't think that I would have figured it out just using one dateadd and one datediff</description><pubDate>Mon, 25 Jan 2010 14:33:46 GMT</pubDate><dc:creator>bgsxygrmn</dc:creator></item><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>[quote]bgsxygrmnThanks, but that doesn't really help me at all. I think that I would have to combine two of the functions that are listed in the link. [/quote]Do not understand your:[quote]that doesn't really help me at all.[/quote]You want someone to give you the complete T-SQL statement?Remember People here help those who help themselvesPlease read the first link in my signature block for the correct procedure to post a question, paying particular attention to table definition, sample data, expected results and [b]what you have done[/b]</description><pubDate>Mon, 25 Jan 2010 14:24:52 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>[code="sql"]declare @FirstPayDate	 datetimeset @FirstPayDate	= '20100101'select	*,	FirstPayDateOfCurrentQuarter =	dateadd(dd,(datediff(dd,@FirstPayDate,dateadd(dd,13,	dateadd(qq,datediff(qq,@FirstPayDate,Date),@FirstPayDate)))/14)*14,@FirstPayDate)from	(	select Date = convert(datetime,'20100727')	union all	select Date = convert(datetime,'20100827')	union all	select Date = convert(datetime,'20101001')	) aorder by	a.Date[/code]Results:[code="plain"]Date                     FirstPayDateOfCurrentQuarter-----------------------  ----------------------------2010-07-27 00:00:00.000  2010-07-02 00:00:00.0002010-08-27 00:00:00.000  2010-07-02 00:00:00.0002010-10-01 00:00:00.000  2010-10-08 00:00:00.000(3 row(s) affected)[/code]</description><pubDate>Mon, 25 Jan 2010 14:24:52 GMT</pubDate><dc:creator>Michael Valentine Jones</dc:creator></item><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>Thanks, but that doesn't really help me at all. I think that I would have to combine two of the functions that are listed in the link.</description><pubDate>Mon, 25 Jan 2010 13:39:14 GMT</pubDate><dc:creator>bgsxygrmn</dc:creator></item><item><title>RE: Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>Go here I am sure you can find what you need.[url]https://www.sqlservercentral.com/blogs/lynnpettis/archive/2009/03/25/some-common-date-routines.aspx[/url]</description><pubDate>Mon, 25 Jan 2010 13:33:52 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>Computing First paydate of quarter</title><link>http://www.sqlservercentral.com/Forums/Topic853270-1292-1.aspx</link><description>Can anyone help me compute the first paydate of the current quarter? This is assuming that there's 14 day intervals for paydates and 1/1/2010 is a paydate. So say the current date is july 27th 2010. The first paydate of the quarter would be july 2nd 2010.Can anyone help?Thanks</description><pubDate>Mon, 25 Jan 2010 13:20:24 GMT</pubDate><dc:creator>bgsxygrmn</dc:creator></item></channel></rss>