473,322 Members | 1,714 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,322 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 2069

<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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.