473,473 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I retrieve the "Week" of a date?

Hi,

I'm trying to find out how I can retrieve the week value of a date.

Today we have 2005-05-08 and week 18.

Let's say I had a dropdownlist with values 1 to 53 and wanted to
programmatically decide what week we have today and accordingly set the
dropdownlist with the correct week value.

Any code that would describe that?

TIA

Kenneth P
Nov 19 '05 #1
2 1358
Kenneth P wrote:
Hi,

I'm trying to find out how I can retrieve the week value of a date.

Today we have 2005-05-08 and week 18.

Let's say I had a dropdownlist with values 1 to 53 and wanted to
programmatically decide what week we have today and accordingly set the
dropdownlist with the correct week value.

Any code that would describe that?

TIA

Kenneth P


Calendar.GetWeekOfYear(..)

http://msdn.microsoft.com/library/de...fyeartopic.asp

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2
"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...
I'm trying to find out how I can retrieve the week value of a date.

Today we have 2005-05-08 and week 18.

Let's say I had a dropdownlist with values 1 to 53 and wanted to
programmatically decide what week we have today and accordingly set the
dropdownlist with the correct week value.

Any code that would describe that?


DateTime dtmDate = DateTime.Now();
int intWeekOfYear = System.Globalization.Calendar.GetWeekOfYear(dtmDat e);
Nov 19 '05 #3

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

Similar topics

1
by: Jason Wells | last post by:
Hello, Here is my table layout: > describe samples; | user | varchar(64) | | PRI | | host | varchar(255) | | PRI | | command | blob | | ...
26
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
4
by: oyvgi | last post by:
I was wondering if it there is an "easy" way to get the dd-mm-yyyy from ww-yyyy. I would like to get, for example the first day (date-month-year) in the week i specify. Found plenty of ways to...
3
by: Craig Bates | last post by:
Hi Guys I have recently been learning SQL from a book whose examples used the Oracle engine. I have now made an Access database containing information for English Football fixtures. I am using...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
10
by: purkka | last post by:
Hi I did not find any solution from Internet how to do it. There is a lot of samples how to retrieve day of the week, but not number of the week. With rgds MP
10
by: sherifffruitfly | last post by:
Hi all, This is how I'm currently getting Friday of last week. It strikes me as cumbersome. Is there a slicker/more elegant way? Thanks for any ideas, cdj
3
by: sbaird | last post by:
Aloha from Hawaii, I'm beating my head on the wall here. I have a recruiting contact managment database I'm trying to create. Managers (there ar 14 of them) have to make a certain number of...
8
by: egrill | last post by:
I have figured out how to extract the serial number of date field into the corresponding number of the week using the DatePart function. The would like to take the 5 and translated it identify the...
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.