DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 31 Jul 2007 16:46:01 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Paul
          2    Hans Kesting
                 3    Paul
                 4    Mark Rae [MVP]
                        5    Paul
                        6    Mark Rae [MVP]
                 7    Juan T. Llibre


find the first thursday from a given month   
HI I have a stored procedure that returns data with a date field in the form 
of a DateTime type.  I need to place data in variables based on days of the 
week starting with the first thursday of the month.  So the week would be 
week 1= (first thursday of the month through the next wed).  So for example 
for July 07 the first thursday is july5th so the first week would be thursday 
july 5th , friday july 6th, sat july 7th, sun july 8th, mon july 9th, tue 
july 10th and wed july 11th.  The second week would start with thursday july 
12.  I think I can do this if I can just get the first thursday of the month 
of the date that is read in but not quite sure how to do this?  I am also 
passing in the day of the week string (mon, tue) ect from the same stored 
procedure.
Thanks Paul.
-- 
Paul G
Software engineer.
Date:Tue, 31 Jul 2007 16:46:01 -0700   Author:  

Re: find the first thursday from a given month   

> HI I have a stored procedure that returns data with a date field in
> the form
> of a DateTime type.  I need to place data in variables based on days
> of the
> week starting with the first thursday of the month.  So the week would
> be
> week 1= (first thursday of the month through the next wed).  So for
> example
> for July 07 the first thursday is july5th so the first week would be
> thursday
> july 5th , friday july 6th, sat july 7th, sun july 8th, mon july 9th,
> tue
> july 10th and wed july 11th.  The second week would start with
> thursday july
> 12.  I think I can do this if I can just get the first thursday of the
> month
> of the date that is read in but not quite sure how to do this?  I am
> also
> passing in the day of the week string (mon, tue) ect from the same
> stored
> procedure.
> Thanks Paul.


Find out what day the first of that month is, then you know how many
days to add to get to the first thursday.

Hans Kesting
Date:Wed, 1 Aug 2007 07:41:17 +0000 (UTC)   Author:  

Re: find the first thursday from a given month   
Hi thanks for the response.  Yes I think what I need is the integer value of 
the first thursday of the month.  I currently have read in the date as a 
datetime type.  Just wondering how to get the first day of the month?
-- 
Paul G
Software engineer.


"Hans Kesting" wrote:


> > HI I have a stored procedure that returns data with a date field in
> > the form
> > of a DateTime type.  I need to place data in variables based on days
> > of the
> > week starting with the first thursday of the month.  So the week would
> > be
> > week 1= (first thursday of the month through the next wed).  So for
> > example
> > for July 07 the first thursday is july5th so the first week would be
> > thursday
> > july 5th , friday july 6th, sat july 7th, sun july 8th, mon july 9th,
> > tue
> > july 10th and wed july 11th.  The second week would start with
> > thursday july
> > 12.  I think I can do this if I can just get the first thursday of the
> > month
> > of the date that is read in but not quite sure how to do this?  I am
> > also
> > passing in the day of the week string (mon, tue) ect from the same
> > stored
> > procedure.
> > Thanks Paul.
> 
> Find out what day the first of that month is, then you know how many
> days to add to get to the first thursday.
> 
> Hans Kesting
> 
> 
> 
Date:Wed, 1 Aug 2007 07:48:00 -0700   Author:  

Re: find the first thursday from a given month   
"Paul"  wrote in message 
news:A2F2EA2F-A5DF-4253-A73C-C80A5B26566A@microsoft.com...


> Hi thanks for the response.  Yes I think what I need is the integer value 
> of
> the first thursday of the month.  I currently have read in the date as a
> datetime type.  Just wondering how to get the first day of the month?


DateTime dtmToday = DateTime.Now;
DateTime dtmFirstOfMonth = new DateTime(dtmToday.Year, dtmToday.Month, 1);


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Wed, 1 Aug 2007 16:16:24 +0100   Author:  

Re: find the first thursday from a given month   
re:
!> Just wondering how to get the first day of the month?

public static DateTime GetFirstDayInMonth(DateTime dt)
{
 DateTime dtRet = new DateTime(dt.Year, dt.Month, 1, 0,0,0); return dtRet;
}




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Paul"  wrote in message news:A2F2EA2F-A5DF-4253-A73C-C80A5B26566A@microsoft.com...

> Hi thanks for the response.  Yes I think what I need is the integer value of
> the first thursday of the month.  I currently have read in the date as a
> datetime type.  Just wondering how to get the first day of the month?
> -- 
> Paul G
> Software engineer.
>
>
> "Hans Kesting" wrote:
>
>> > HI I have a stored procedure that returns data with a date field in
>> > the form
>> > of a DateTime type.  I need to place data in variables based on days
>> > of the
>> > week starting with the first thursday of the month.  So the week would
>> > be
>> > week 1= (first thursday of the month through the next wed).  So for
>> > example
>> > for July 07 the first thursday is july5th so the first week would be
>> > thursday
>> > july 5th , friday july 6th, sat july 7th, sun july 8th, mon july 9th,
>> > tue
>> > july 10th and wed july 11th.  The second week would start with
>> > thursday july
>> > 12.  I think I can do this if I can just get the first thursday of the
>> > month
>> > of the date that is read in but not quite sure how to do this?  I am
>> > also
>> > passing in the day of the week string (mon, tue) ect from the same
>> > stored
>> > procedure.
>> > Thanks Paul.
>>
>> Find out what day the first of that month is, then you know how many
>> days to add to get to the first thursday.
>>
>> Hans Kesting
>>
>>
>>
Date:Wed, 1 Aug 2007 11:15:48 -0400   Author:  

Re: find the first thursday from a given month   
Thanks for the replies, it works!
-- 
Paul G
Software engineer.


"Mark Rae [MVP]" wrote:


> "Paul"  wrote in message 
> news:A2F2EA2F-A5DF-4253-A73C-C80A5B26566A@microsoft.com...
> 
> > Hi thanks for the response.  Yes I think what I need is the integer value 
> > of
> > the first thursday of the month.  I currently have read in the date as a
> > datetime type.  Just wondering how to get the first day of the month?
> 
> DateTime dtmToday = DateTime.Now;
> DateTime dtmFirstOfMonth = new DateTime(dtmToday.Year, dtmToday.Month, 1);
> 
> 
> -- 
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net 
> 
> 
Date:Wed, 1 Aug 2007 10:36:03 -0700   Author:  

Re: find the first thursday from a given month   
"Paul"  wrote in message 
news:7FA59CBD-7F40-4108-911B-200A9FC9C9B0@microsoft.com...


> Thanks for the replies, it works!


DateTime dtmToday = DateTime.Now;
DateTime dtmFirstOfMonth = new DateTime(dtmToday.Year, dtmToday.Month, 1);
DateTime dtmFirstThursday = dtmFirstOfMonth;
while (dtmFirstThursday.DayOfWeek != DayOfWeek.Thursday)
{
    dtmFirstThursday = dtmFirstThursday.AddDays(1);
}


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Wed, 1 Aug 2007 18:50:39 +0100   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us