Home All Groups Group Topic Archive Search About

Convert date to number of week

Author
7 Jun 2006 8:49 PM
Manekurt
Hello, does anyone knows how to convert a date, into a number of week of an
year? for example
mm/dd/yyyy    01/04/2006 convert to 1 (week number 1 of the year)


Thanik you

Author
7 Jun 2006 9:47 PM
Herfried K. Wagner [MVP]
"Manekurt" <marcosbv@g_a_m_a_c_o_m.com.ar> schrieb:
> Hello, does anyone knows how to convert a date, into a number of week of
> an year? for example
> mm/dd/yyyy    01/04/2006 convert to 1 (week number 1 of the year)

The .NET Framework provides a way to do that
('System.Globalization.Calendar.GetWeekOfYear'), but notice that this method
is not ISO-8601-compliant.  You may want to look for an ISO-compliant
solution here:

<URL:http://www.google.de/groups?q=dotnet+week+iso+8601>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
8 Jun 2006 5:19 AM
Cor Ligthert [MVP]
Herfried and Manekurt,

Have a look at the fine sample Peter made for us europeans

http://www.vb-tips.com/default.aspx?ID=6e1f4d4e-8ef4-487b-bdc1-320988226459

Cor

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
news:%23NobyvniGHA.4276@TK2MSFTNGP03.phx.gbl...
> "Manekurt" <marcosbv@g_a_m_a_c_o_m.com.ar> schrieb:
>> Hello, does anyone knows how to convert a date, into a number of week of
>> an year? for example
>> mm/dd/yyyy    01/04/2006 convert to 1 (week number 1 of the year)
>
> The .NET Framework provides a way to do that
> ('System.Globalization.Calendar.GetWeekOfYear'), but notice that this
> method
> is not ISO-8601-compliant.  You may want to look for an ISO-compliant
> solution here:
>
> <URL:http://www.google.de/groups?q=dotnet+week+iso+8601>
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
8 Jun 2006 4:07 PM
Claes Bergefall
Show quote Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%23NobyvniGHA.4276@TK2MSFTNGP03.phx.gbl...
> "Manekurt" <marcosbv@g_a_m_a_c_o_m.com.ar> schrieb:
>> Hello, does anyone knows how to convert a date, into a number of week of
>> an year? for example
>> mm/dd/yyyy    01/04/2006 convert to 1 (week number 1 of the year)
>
> The .NET Framework provides a way to do that
> ('System.Globalization.Calendar.GetWeekOfYear'), but notice that this
> method
> is not ISO-8601-compliant.  You may want to look for an ISO-compliant
> solution here:
>
> <URL:http://www.google.de/groups?q=dotnet+week+iso+8601>
>

Also note that the bug described at http://support.microsoft.com/?id=200299
still exists. It affects the DateTime and Calendar stuff in .NET too and not
just in classic VB as it says in the article (or at least it did in 2003,
haven't verified it in 2005)

   /claes