473,769 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
+ 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
programmaticall y 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 1369
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
programmaticall y 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.GetWee kOfYear(..)

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

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2
"Kenneth P" <Ke******@discu ssions.microsof t.com> wrote in message
news:6E******** *************** ***********@mic rosoft.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
programmaticall y 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.Globaliz ation.Calendar. GetWeekOfYear(d tmDate);
Nov 19 '05 #3

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

Similar topics

1
1324
by: Jason Wells | last post by:
Hello, Here is my table layout: > describe samples; | user | varchar(64) | | PRI | | host | varchar(255) | | PRI | | command | blob | | | | date | datetime | | PRI | | pid | int(11) | | PRI | | jval | smallint(6) | | |
26
12583
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
2385
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 go th other way, but none that give me the reverse. Idealy I would like both the beginning date/time and the end date/time of the specified week, but if i can just get a hold one of the or some other defined time in this week i could probably...
3
11337
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 ASP pages and ADO to access and query this database for information. One piece of information I want to retrieve is a list of all the football fixtures for the current week - that is, all the fixtures from the current day until the next Sunday -...
3
3121
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 working week definition. Lets say I have a working week definition of Monday through Friday, 9 am to 5 pm. Date1 = January 1st, 2005 at 8 am
10
2752
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
32832
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
2625
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 recruiting calls per week, and so many of them have to result in at least an appointment. However, the "week" is Wednesday, 12:01pm to the following Wednesday, 12:00noon. So here are my questions... 1) Is there a way to change the standard week...
8
2510
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 week of associate with the series. For example if the serial number was 5 it corresponds the the fith week in January which is the week of January 28th. Does have a work around or knowledge of the next steps to get this information. Thank you ...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9984
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7401
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
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.