473,289 Members | 2,108 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,289 software developers and data experts.

Number of weeks in year?

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.
Sep 16 '08 #1
14 18973
"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...
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).
float w = (DateTime.IsLeapYear(year) ? 366 : 365) / 7

Or are do you measure the count of weeks by the appearance of a specific day
of the week considered to be the start of a week in that year?

--
Anthony Jones - MVP ASP/ASP.NET

Sep 16 '08 #2
Is there something special about the Danish calendar? i.e. is the answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...
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.
Sep 16 '08 #3

"Clint" wrote:
Is there something special about the Danish calendar? i.e. is the answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com...
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.
Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53

--
Happy Coding!
Morten Wennevik [C# MVP]

Sep 16 '08 #4
Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31) returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
>
"Clint" wrote:
>Is there something special about the Danish calendar? i.e. is the answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com.. .
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.

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #5
TAB
Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e. at
least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com...
Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
>>
"Clint" wrote:
>>Is there something special about the Danish calendar? i.e. is the answer
not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com. ..
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.

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #6
Thank you. Thats working yes, but it doesn't return the number of weeks in the
year. It returns the correct number of the week at day 2008-12-31 (week 1, not
53).

How can I modify this to return the number of weeks in the year (52 or 53)?

On Tue, 16 Sep 2008 16:27:09 +0200, "TAB" <an*************@email.comwrote:
>Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e. at
least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com.. .
>Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
>>>
"Clint" wrote:

Is there something special about the Danish calendar? i.e. is the answer
not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com ...
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.
Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #7
TAB
I think this is the source of what I wrote and the same method somewhat
modified.

"Simen Sandelien says that will
produce results incompatible with ISO 8601"

"He has this to say about that :"

"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."

private int WeekNumber_Entire4DayWeekRule(DateTime date)
{

const int JAN = 1;
const int DEC = 12;
const int LASTDAYOFDEC = 31;
const int FIRSTDAYOFJAN = 1;
const int THURSDAY = 4;
bool ThursdayFlag = false;

int DayOfYear = date.DayOfYear;

int StartWeekDayOfYear =
(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
int EndWeekDayOfYear =
(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;

StartWeekDayOfYear = StartWeekDayOfYear;
EndWeekDayOfYear = EndWeekDayOfYear;
if( StartWeekDayOfYear == 0)
StartWeekDayOfYear = 7;
if( EndWeekDayOfYear == 0)
EndWeekDayOfYear = 7;

int DaysInFirstWeek = 8 - (StartWeekDayOfYear );
int DaysInLastWeek = 8 - (EndWeekDayOfYear );

if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
ThursdayFlag = true;

int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);

int WeekNumber = FullWeeks;

if (DaysInFirstWeek >= THURSDAY)
WeekNumber = WeekNumber +1;

if (WeekNumber 52 && !ThursdayFlag)
WeekNumber = 1;

if (WeekNumber == 0)
WeekNumber = WeekNumber_Entire4DayWeekRule(
new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
return WeekNumber;
}

"TAB" <an*************@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com...
>Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
>>>
"Clint" wrote:

Is there something special about the Danish calendar? i.e. is the
answer not
always 52? (plus a couple of days)

"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.com ...
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.
Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #8
TAB


"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:t2********************************@4ax.com...
Thank you. Thats working yes, but it doesn't return the number of weeks in
the
year. It returns the correct number of the week at day 2008-12-31 (week 1,
not
53).

How can I modify this to return the number of weeks in the year (52 or
53)?

On Tue, 16 Sep 2008 16:27:09 +0200, "TAB" <an*************@email.com>
wrote:
>>Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at
least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com. ..
>>Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
"Clint" wrote:

Is there something special about the Danish calendar? i.e. is the
answer
not
always 52? (plus a couple of days)
>
"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.co m...
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.
>

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week =
CultureInfo.CurrentCulture.Calendar.GetWeekOfYe ar(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #9
TAB
One way would be to do a loop and subtract 1 day until you find a weeknumber
bigger than 1, that would be 53 or 52.

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:t2********************************@4ax.com...
Thank you. Thats working yes, but it doesn't return the number of weeks in
the
year. It returns the correct number of the week at day 2008-12-31 (week 1,
not
53).

How can I modify this to return the number of weeks in the year (52 or
53)?

On Tue, 16 Sep 2008 16:27:09 +0200, "TAB" <an*************@email.com>
wrote:
>>Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at
least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com. ..
>>Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
"Clint" wrote:

Is there something special about the Danish calendar? i.e. is the
answer
not
always 52? (plus a couple of days)
>
"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.co m...
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.
>

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week =
CultureInfo.CurrentCulture.Calendar.GetWeekOfYe ar(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #10
That method returns the same as the previous method, doesn't it?

It's still not what I'm looking for.

On Tue, 16 Sep 2008 16:44:03 +0200, "TAB" <an*************@email.comwrote:
>I think this is the source of what I wrote and the same method somewhat
modified.

"Simen Sandelien says that will
produce results incompatible with ISO 8601"

"He has this to say about that :"

"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."

private int WeekNumber_Entire4DayWeekRule(DateTime date)
{

const int JAN = 1;
const int DEC = 12;
const int LASTDAYOFDEC = 31;
const int FIRSTDAYOFJAN = 1;
const int THURSDAY = 4;
bool ThursdayFlag = false;

int DayOfYear = date.DayOfYear;

int StartWeekDayOfYear =
(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
int EndWeekDayOfYear =
(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;

StartWeekDayOfYear = StartWeekDayOfYear;
EndWeekDayOfYear = EndWeekDayOfYear;
if( StartWeekDayOfYear == 0)
StartWeekDayOfYear = 7;
if( EndWeekDayOfYear == 0)
EndWeekDayOfYear = 7;

int DaysInFirstWeek = 8 - (StartWeekDayOfYear );
int DaysInLastWeek = 8 - (EndWeekDayOfYear );

if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
ThursdayFlag = true;

int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);

int WeekNumber = FullWeeks;

if (DaysInFirstWeek >= THURSDAY)
WeekNumber = WeekNumber +1;

if (WeekNumber 52 && !ThursdayFlag)
WeekNumber = 1;

if (WeekNumber == 0)
WeekNumber = WeekNumber_Entire4DayWeekRule(
new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
return WeekNumber;
}

"TAB" <an*************@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
>Hi Tommy

I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com.. .
>>Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
"Clint" wrote:

Is there something special about the Danish calendar? i.e. is the
answer not
always 52? (plus a couple of days)
>
"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
news:1m********************************@4ax.co m...
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.
>

Sometimes there are 53 weeks in a year.

int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
// week == 53
Sep 16 '08 #11
TAB
Start with the last day of the year and subtract on day at a time until you
find the previous week, whatever it may be.
"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:44********************************@4ax.com...
That method returns the same as the previous method, doesn't it?

It's still not what I'm looking for.

On Tue, 16 Sep 2008 16:44:03 +0200, "TAB" <an*************@email.com>
wrote:
>>I think this is the source of what I wrote and the same method somewhat
modified.

"Simen Sandelien says that will
produce results incompatible with ISO 8601"

"He has this to say about that :"

"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."

private int WeekNumber_Entire4DayWeekRule(DateTime date)
{

const int JAN = 1;
const int DEC = 12;
const int LASTDAYOFDEC = 31;
const int FIRSTDAYOFJAN = 1;
const int THURSDAY = 4;
bool ThursdayFlag = false;

int DayOfYear = date.DayOfYear;

int StartWeekDayOfYear =
(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
int EndWeekDayOfYear =
(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;

StartWeekDayOfYear = StartWeekDayOfYear;
EndWeekDayOfYear = EndWeekDayOfYear;
if( StartWeekDayOfYear == 0)
StartWeekDayOfYear = 7;
if( EndWeekDayOfYear == 0)
EndWeekDayOfYear = 7;

int DaysInFirstWeek = 8 - (StartWeekDayOfYear );
int DaysInLastWeek = 8 - (EndWeekDayOfYear );

if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
ThursdayFlag = true;

int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);

int WeekNumber = FullWeeks;

if (DaysInFirstWeek >= THURSDAY)
WeekNumber = WeekNumber +1;

if (WeekNumber 52 && !ThursdayFlag)
WeekNumber = 1;

if (WeekNumber == 0)
WeekNumber = WeekNumber_Entire4DayWeekRule(
new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
return WeekNumber;
}

"TAB" <an*************@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
>>Hi Tommy

I had the same problem when I was working with a calendarprogram and
found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com. ..
Hi Clint.

That doesn't work.

Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.

Any idea?

On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:

>
>"Clint" wrote:
>
>Is there something special about the Danish calendar? i.e. is the
>answer not
>always 52? (plus a couple of days)
>>
>"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
>news:1m********************************@4ax.c om...
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.
>>
>
>Sometimes there are 53 weeks in a year.
>
int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week =
CultureInfo.CurrentCulture.Calendar.GetWeekOfY ear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
>
>
// week == 53
Sep 16 '08 #12
On Sep 16, 10:54*am, Tommy Jakobsen <to...@holmjakobsen.dkwrote:
That method returns the same as the previous method, doesn't it?

It's still not what I'm looking for.

On Tue, 16 Sep 2008 16:44:03 +0200, "TAB" <anders.bergl...@email.comwrote:
I think this is the source of what I wrote and the same method somewhat
modified.
"Simen Sandelien says that will
produce results incompatible with ISO 8601"
"He has this to say about that :"
"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."
private int WeekNumber_Entire4DayWeekRule(DateTime date)
{
* * const int JAN = 1;
* * const int DEC = 12;
* * const int LASTDAYOFDEC = 31;
* * const int FIRSTDAYOFJAN = 1;
* * const int THURSDAY = 4;
* * bool ThursdayFlag = false;
* * int DayOfYear = date.DayOfYear;
* * int StartWeekDayOfYear =
* * * * *(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
* * int EndWeekDayOfYear =
* * * * *(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;
* * StartWeekDayOfYear = StartWeekDayOfYear;
* * EndWeekDayOfYear = EndWeekDayOfYear;
* * if( StartWeekDayOfYear == 0)
* * * * *StartWeekDayOfYear = 7;
* * if( EndWeekDayOfYear == 0)
* * * * *EndWeekDayOfYear = 7;
* * int DaysInFirstWeek = 8 - (StartWeekDayOfYear *);
* * int DaysInLastWeek = 8 - (EndWeekDayOfYear );
* * if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
* * * * *ThursdayFlag = true;
* * int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);
* * int WeekNumber = FullWeeks;
* * if (DaysInFirstWeek >= THURSDAY)
* * * * *WeekNumber = WeekNumber +1;
* * if (WeekNumber 52 && !ThursdayFlag)
* * * * *WeekNumber = 1;
* * if (WeekNumber == 0)
* * * * *WeekNumber = WeekNumber_Entire4DayWeekRule(
* * * * * * * new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
* * return WeekNumber;
}
"TAB" <anders.bergl...@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
Hi Tommy
I had the same problem when I was working with a calendarprogram and found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.
* * * *// get week number for current date
* * * *public int WeekNumber(DateTime fromDate)
* * * *{
* * * * * *// Get jan 1st of the year
* * * * * *DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
* * * * * *// Get dec 31st of the year
* * * * * *DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
* * * * * *// ISO 8601 weeks start with Monday
* * * * * *// The first week of a year includes the first Thursday, i.e.
at least 4 days
* * * * * *// DayOfWeek returns 0 for sunday up to 6 for Saturday
* * * * * *int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
* * * * * *int nds = fromDate.Subtract(startOfYear).Days+
iso8601Correction[(int)startOfYear.DayOfWeek];
* * * * * *int wk = nds / 7;
* * * * * *switch (wk)
* * * * * *{
* * * * * * * *case 0:
* * * * * * * * * *// Return weeknumber of dec 31st of the previous year
* * * * * * * * * *return WeekNumber(startOfYear.AddDays(-1));
* * * * * * * *case 53:
* * * * * * * * * *// If dec 31st falls before thursday it is week 01 of
next year
* * * * * * * * * *if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
* * * * * * * * * * * *return 1;
* * * * * * * * * *else
* * * * * * * * * * * *return wk;
* * * * * * * *default: return wk;
* * * * * *}
"Tommy Jakobsen" <to...@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com.. .
Hi Clint.
>That doesn't work.
>Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.
>Any idea?
>On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<MortenWenne...@hotmail.comwrote:
>>>"Clint" wrote:
>>>Is there something special about the Danish calendar? i.e. is the
answer not
always 52? (plus a couple of days)
>>>"Tommy Jakobsen" <to...@holmjakobsen.dkwrote in message
news:1m********************************@4ax.co m...
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.
>>>Sometimes there are 53 weeks in a year.
>>* * * * * *int year = 2004;
* * * * * *DateTime dt = new DateTime(year, 12, 31);
* * * * * *int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
* * * * * * * *dt,
* * * * * * * *CalendarWeekRule.FirstFourDayWeek,
* * * * * * * *DayOfWeek.Monday);
>>* * * * * *// week == 53- Hide quoted text -

- Show quoted text -
I'd echo firts responder's question - what do you consider the first
week?

The example in this article should clarify things a bit:
http://msdn.microsoft.com/en-us/libr...le(VS.95).aspx
Sep 16 '08 #13
I got it modified to take year as parameter and return the total number of weeks
(52/53) in that year.

Thanks for your replies guys.

On Tue, 16 Sep 2008 17:18:20 +0200, "TAB" <an*************@email.comwrote:
>Start with the last day of the year and subtract on day at a time until you
find the previous week, whatever it may be.
"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:44********************************@4ax.com.. .
>That method returns the same as the previous method, doesn't it?

It's still not what I'm looking for.

On Tue, 16 Sep 2008 16:44:03 +0200, "TAB" <an*************@email.com>
wrote:
>>>I think this is the source of what I wrote and the same method somewhat
modified.

"Simen Sandelien says that will
produce results incompatible with ISO 8601"

"He has this to say about that :"

"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."

private int WeekNumber_Entire4DayWeekRule(DateTime date)
{

const int JAN = 1;
const int DEC = 12;
const int LASTDAYOFDEC = 31;
const int FIRSTDAYOFJAN = 1;
const int THURSDAY = 4;
bool ThursdayFlag = false;

int DayOfYear = date.DayOfYear;

int StartWeekDayOfYear =
(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
int EndWeekDayOfYear =
(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;

StartWeekDayOfYear = StartWeekDayOfYear;
EndWeekDayOfYear = EndWeekDayOfYear;
if( StartWeekDayOfYear == 0)
StartWeekDayOfYear = 7;
if( EndWeekDayOfYear == 0)
EndWeekDayOfYear = 7;

int DaysInFirstWeek = 8 - (StartWeekDayOfYear );
int DaysInLastWeek = 8 - (EndWeekDayOfYear );

if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
ThursdayFlag = true;

int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);

int WeekNumber = FullWeeks;

if (DaysInFirstWeek >= THURSDAY)
WeekNumber = WeekNumber +1;

if (WeekNumber 52 && !ThursdayFlag)
WeekNumber = 1;

if (WeekNumber == 0)
WeekNumber = WeekNumber_Entire4DayWeekRule(
new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
return WeekNumber;
}

"TAB" <an*************@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
Hi Tommy

I had the same problem when I was working with a calendarprogram and
found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.

// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}

"Tommy Jakobsen" <to***@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com ...
Hi Clint.
>
That doesn't work.
>
Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.
>
Any idea?
>
On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<Mo************@hotmail.comwrote:
>
>>
>>"Clint" wrote:
>>
>>Is there something special about the Danish calendar? i.e. is the
>>answer not
>>always 52? (plus a couple of days)
>>>
>>"Tommy Jakobsen" <to***@holmjakobsen.dkwrote in message
>>news:1m********************************@4ax. com...
>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.
>>>
>>
>>Sometimes there are 53 weeks in a year.
>>
> int year = 2004;
> DateTime dt = new DateTime(year, 12, 31);
> int week =
>CultureInfo.CurrentCulture.Calendar.GetWeekOf Year(
> dt,
> CalendarWeekRule.FirstFourDayWeek,
> DayOfWeek.Monday);
>>
>>
> // week == 53
Sep 16 '08 #14
TAB


"G.S." <gs******@gmail.comskrev i meddelandet
news:81**********************************@e53g2000 hsa.googlegroups.com...
On Sep 16, 10:54 am, Tommy Jakobsen <to...@holmjakobsen.dkwrote:
>That method returns the same as the previous method, doesn't it?

It's still not what I'm looking for.

On Tue, 16 Sep 2008 16:44:03 +0200, "TAB" <anders.bergl...@email.com>
wrote:
>I think this is the source of what I wrote and the same method somewhat
modified.
>"Simen Sandelien says that will
produce results incompatible with ISO 8601"
>"He has this to say about that :"
>"My conclusion is that the builtin .NET FourDayWeekRule
and the GetWeekOfYear() method do NOT produce
week numbers according to ISO 8601."
>private int WeekNumber_Entire4DayWeekRule(DateTime date)
{
const int JAN = 1;
const int DEC = 12;
const int LASTDAYOFDEC = 31;
const int FIRSTDAYOFJAN = 1;
const int THURSDAY = 4;
bool ThursdayFlag = false;
int DayOfYear = date.DayOfYear;
int StartWeekDayOfYear =
(int)(new DateTime(date.Year, JAN, FIRSTDAYOFJAN)).DayOfWeek;
int EndWeekDayOfYear =
(int)(new DateTime(date.Year, DEC, LASTDAYOFDEC)).DayOfWeek;
StartWeekDayOfYear = StartWeekDayOfYear;
EndWeekDayOfYear = EndWeekDayOfYear;
if( StartWeekDayOfYear == 0)
StartWeekDayOfYear = 7;
if( EndWeekDayOfYear == 0)
EndWeekDayOfYear = 7;
int DaysInFirstWeek = 8 - (StartWeekDayOfYear );
int DaysInLastWeek = 8 - (EndWeekDayOfYear );
if (StartWeekDayOfYear == THURSDAY || EndWeekDayOfYear == THURSDAY)
ThursdayFlag = true;
int FullWeeks = (int) Math.Ceiling((DayOfYear -
(DaysInFirstWeek))/7.0);
int WeekNumber = FullWeeks;
if (DaysInFirstWeek >= THURSDAY)
WeekNumber = WeekNumber +1;
if (WeekNumber 52 && !ThursdayFlag)
WeekNumber = 1;
if (WeekNumber == 0)
WeekNumber = WeekNumber_Entire4DayWeekRule(
new DateTime(date.Year-1, DEC, LASTDAYOFDEC));
return WeekNumber;
}
>"TAB" <anders.bergl...@email.comskrev i meddelandet
news:e9**************@TK2MSFTNGP02.phx.gbl...
Hi Tommy
>I had the same problem when I was working with a calendarprogram and
found
this somewhere on the Internet.
Apperently there is an old bug .Net that hasn't be solved yet.
This is working for me, I have checked several years back and forth.
>// get week number for current date
public int WeekNumber(DateTime fromDate)
{
// Get jan 1st of the year
DateTime startOfYear = fromDate.AddDays(-fromDate.Day +
1).AddMonths(-fromDate.Month + 1);
// Get dec 31st of the year
DateTime endOfYear = startOfYear.AddYears(1).AddDays(-1);
// ISO 8601 weeks start with Monday
// The first week of a year includes the first Thursday, i.e.
at least 4 days
// DayOfWeek returns 0 for sunday up to 6 for Saturday
int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
int nds = fromDate.Subtract(startOfYear).Days +
iso8601Correction[(int)startOfYear.DayOfWeek];
int wk = nds / 7;
switch (wk)
{
case 0:
// Return weeknumber of dec 31st of the previous year
return WeekNumber(startOfYear.AddDays(-1));
case 53:
// If dec 31st falls before thursday it is week 01 of
next year
if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
return 1;
else
return wk;
default: return wk;
}
>"Tommy Jakobsen" <to...@holmjakobsen.dkskrev i meddelandet
news:n0********************************@4ax.com. ..
Hi Clint.
>>That doesn't work.
>>Theres an error in the framework. Using date DateTime(2008, 12, 31)
returns 53,
but theres only 52 weeks in year 2008.
>>Any idea?
>>On Tue, 16 Sep 2008 06:55:01 -0700, Morten Wennevik [C# MVP]
<MortenWenne...@hotmail.comwrote:
>>>>"Clint" wrote:
>>>>Is there something special about the Danish calendar? i.e. is the
answer not
always 52? (plus a couple of days)
>>>>"Tommy Jakobsen" <to...@holmjakobsen.dkwrote in message
>news:1m********************************@4ax.c om...
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.
>>>>Sometimes there are 53 weeks in a year.
>>>int year = 2004;
DateTime dt = new DateTime(year, 12, 31);
int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
dt,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday);
>>>// week == 53- Hide quoted text -

- Show quoted text -

I'd echo firts responder's question - what do you consider the first
week?

The example in this article should clarify things a bit:
http://msdn.microsoft.com/en-us/libr...le(VS.95).aspx
It's been a long time since I worked with this so I have to quote
Wikipedia on ISO 8601 regarding week numbers.

The ISO year number deviates from the number of the Gregorian year on, if
applicable, a Friday, Saturday, and Sunday, or a Saturday and Sunday, or
just a Sunday, at the start of the Gregorian year (which are at the end of
the previous ISO year) and a Monday, Tuesday and Wednesday, or a Monday and
Tuesday, or just a Monday, at the end of the Gregorian year (which are in
week 01 of the next ISO year). In the period 4 January-28 December and on
all Thursdays the ISO year number is always equal to the Gregorian year
number.

Mutually equivalent definitions for week 01 are:
the week with the year's first Thursday in it
the week starting with the Monday which is nearest in time to 1 January
the week with the year's first working day in it (if Saturdays, Sundays, and
1 January are not working days)
the week with January 4 in it
the first week with the majority (four or more) of its days in the starting
year
the week starting with the Monday in the period 29 December - 4 January
the week with the Thursday in the period 1 - 7 January
If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week
01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53
of the previous year.
Note that while most definitions are symmetric with respect to time
reversal, one definition in terms of working days happens to be equivalent.

The last week of the ISO year is the week before week 01; in accordance with
the symmetry of the definition, equivalent definitions are:
the week with the year's last Thursday in it
the week ending with the Sunday which is nearest in time to 31 December
the week with December 28 in it
the last week with the majority (four or more) of its days in the ending
year
the week starting with the Monday in the period 22 - 28 December
the week with the Thursday in the period 25 - 31 December
the week ending with the Sunday in the period 28 December - 3 January
If 31 December is on a Monday, Tuesday, or Wednesday, it is in week 01 of
the next year, otherwise in week 52 or 53.
The following years have 53 weeks:
years starting with Thursday
leap years starting with Wednesday
Sep 16 '08 #15

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

Similar topics

6
by: Orson | last post by:
I have a page that uses the javascript Date() function to retrieve a date from the client computer. The date is then inserted into a note that is saved on a database. The date is in the format...
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
3
by: Aussie Rules | last post by:
Hi, How do I extract just the month part of a date. Say for example I wanted to get the value of 6 (as in sixth month) from todays date. Regards
3
by: cassey14 | last post by:
Hi Guys... Im doing a system and it really make my head ache..i hope somebody help me.. I need to have an id like this "ABCD-07-000001"... I dont know how will I work on that thing.. ABCD...
13
by: Gari | last post by:
Dear All, Back to my project database (if you have read my previous thread requests ^^). I have a project database. I will add an edit form that will be used to add new projects. I would...
2
by: JamesG | last post by:
Hi, How would I convert a week number and year into a date? Thanks!
3
by: Libber39 | last post by:
Hi everyone, Have a query on how to calculate the amount of weeks and days contained in a number in an access query. ie: the difference in days between 2 dates amounts to 17 days. I want to now...
7
by: shimul | last post by:
Need to get a formula which will give me rolling year to retrieve data. For Example: when i run query this week, need date >=2008/01/07 and <=2009/01/04 to cover the rolling year (week start...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
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: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...

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.