Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 July 26th, 2004, 02:08 AM
fvg fvg is offline
Registered User
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date and Time Information

I am trying to find out a solution to the two following problems:
* given the number of the week, how do I get the days composing that week in the format for instance "dd/MM"?
* given a date (for instance 21/07/2004) how do I find the number of the week that day is belonging to?


Old July 26th, 2004, 07:50 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts


This might help...

Old July 26th, 2004, 08:03 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

you should use System.DateTime structer.
you can do like below
if numberOfWeek is 2 that means we are in the second week of year
//Part 1
DateTime dtm=new DateTime(2004,1,1);
DateTime firstDayOfWeek=dtm.AddDays((numberOfWeek-1)*7);
DateTime lastDayOfWeek=dtm.AddDays(numberOfWeek*7-1);
//then with properties and method of DateTime structure get evrything you need
//and also change the output format
//Part 2
DateTime dtm=new DateTime(2004,7,21);
double result=(double)dtm.DayOfYear/7;
{ return (int)result;
 return System.Convert.ToInt32(result)+1;

Hope this could help you.

I'm waiting for your better idea.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting Time from Date/Time Navy1991_1 XSLT 2 June 3rd, 2008 12:03 PM
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
How to retieve only the date not date and time debjanib ASP.NET 1.0 and 1.1 Professional 2 July 25th, 2006 01:10 PM
insert system date. no date and time jimmy Access VBA 6 November 20th, 2003 01:11 PM
Date and Time scottma135 VB Components 0 August 26th, 2003 10:02 AM

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