Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2009, 05:57 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default How to add Weeks to a date?

Hi

I am looking at DateTime in C# and it seems that their is no option to add weeks.

So I am not really sure how to calculate it. Like 7 * 52 = 364 days but there are 365 days a year or 366.

So I am guessing here this is where the leap year factors in but I am not sure how to factor that in.
 
Old March 20th, 2009, 06:32 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

What you need to do.. you can add 7 days * number of weeks you need...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old March 20th, 2009, 07:01 PM
Friend of Wrox
 
Join Date: Sep 2007
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by gbianchi View Post
What you need to do.. you can add 7 days * number of weeks you need...
well I changed it now so I think the problem is now solved but when I was thinking of this I was looking at 52 weeks and that gives 364 days so I would be cheating them out of a day. If I added one day then I would be cheating myself out of a day.

So I am using the addYear for the 52 weeks and days for the ones less then 52 weeks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ok 2 weeks of this and no I am braindead aasiddle ASP.NET 2.0 Basics 3 March 14th, 2007 10:36 PM
Working with weeks Vince_421 Access 5 January 30th, 2007 12:34 PM
weeks yula Crystal Reports 1 August 31st, 2006 11:28 AM
Add an hour to a date (solution) g000we Classic ASP Basics 1 July 26th, 2006 06:24 AM
When is two weeks later? Snib Javascript How-To 2 November 28th, 2003 04:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.