473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get week span with weekNumber and Year

Hi!!

know someone how to get a week span with week number and year?

something like hi:

public static DateTime[] GetWeekSpan(int weekNumber, int year)
{
DateTime weekStartDate = new DateTime();
DateTime weekEndDate = new DateTime();

//do something to find the sweek span!!!!

DateTime[] currentWeekSpan = new DateTime[2];

currentWeekSpan[0] = weekStartDate;
currentWeekSpan[1] = weekEndDate;

return currentWeekSpan;
}

any ideas???
regards,

gicio
Nov 18 '05 #1
1 2073

<gi***@gmx.de> wrote in message news:ej**************@tk2msftngp13.phx.gbl...
Hi!!

know someone how to get a week span with week number and year?

something like hi:

public static DateTime[] GetWeekSpan(int weekNumber, int year)
{
DateTime weekStartDate = new DateTime();
DateTime weekEndDate = new DateTime();

//do something to find the sweek span!!!!

DateTime[] currentWeekSpan = new DateTime[2];

currentWeekSpan[0] = weekStartDate;
currentWeekSpan[1] = weekEndDate;

return currentWeekSpan;
}

any ideas???
regards,

gicio


Basically you need to find the startdate of a particular week. This depends
on the particular locale (for instance: in the Netherlands week 1 of 2004 starts
at monday, december 29, 2003 and week 1 of 2005 is jan 3, 2005)
Maybe you could try the following:
- find the startday of week 1 of the year
- first day is sunday or monday (or other?)
- week 1 could be "includes jan 1", "first full week", "at least 4 days", ...
- add the number of weeks (minus one, as the numbering starts at 1)

Hans Kesting
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Shuffs | last post by:
Could someone, anyone please tell me what I need to amend, to get this function to take Sunday as the first day of the week? I amended the Weekday parts to vbSunday (in my code, not the code...
2
by: | last post by:
Hi!! know someone how to get a week span with week number and year? something like hi: public static DateTime GetWeekSpan(int weekNumber, int year) { DateTime weekStartDate = new...
3
by: Totto | last post by:
Hi, Is it possible to get number of the week from a DateTime type ? Tnx Totto
4
by: jyohere | last post by:
How can i get the week of a year for a particular date that i give.....not for the calendar date
1
by: rcr69er | last post by:
Hi I am trying to produce a script that will show date for the last day of the week(Sunday). The script will have to show dates for all weeks of the year. Does anyone know how this can be done? ...
0
by: pratapmysql | last post by:
Hello All, I am trying to get same day (name) of week of last year in this case date of day is not constraint eg. if december 2007-12-19 day is wednesday ,then last year 2006 wednesday for same is...
4
by: Charlotte | last post by:
Hi, is it possible to determine the first and the last day of a week (with classic ASP) nu = "06/01/2008" week = (DatePart("ww",nu)) firstday = dateadd("d",(-datepart("w",date())),nu)...
3
by: dponce | last post by:
Hello Forum, I will try to be as detailed as possible, I feel you would better understand what I am trying to do if I could email or upload the database to you all instead. If there is a way to...
5
by: Aljosa Mohorovic | last post by:
i use this to find out current week and total number of weeks for current year: now = datetime.now() weeks_in_year = int(date(now.year, 12, 31).strftime("%W")) current_week = int(date(now.year,...
14
by: Tommy Jakobsen | last post by:
Hi. Is there a method in .NET that takes "year" as an argument and returns the total number of weeks in that year? For culture da-DK (Danish). Thanks in advance. Tommy.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.