473,382 Members | 1,775 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,382 software developers and data experts.

Date Return if selected a weeknumber from a year, eg, Wk 20. Help..Anyone??

Does anyone know whether when I select a weeknumber of a certain year, eg.
2004, the date from first day to the last day of the week will be known.

Regards
Vanessa
Nov 20 '05 #1
1 1116
use this

Dim d As Date

Dim weeknum As Integer

Dim firstdate As Date

Dim lastdate As Date

Dim daystoadd As Integer

weeknum = InputBox("Enter Week Number")

d = DateSerial(2004, 1, 1)

daystoadd = (7 * (weeknum - 1)) - (7 - Weekday(d, FirstDayOfWeek.Monday))

firstdate = d.AddDays(daystoadd)

lastdate = firstdate.AddDays(6)

This only will not wrok proper for first and last week, but u can modify and
handle exception of 1 and last week and make it correct

Vicky

"Vanessa" <va*****@eclinic.com.sg> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
Does anyone know whether when I select a weeknumber of a certain year, eg.
2004, the date from first day to the last day of the week will be known.

Regards
Vanessa

Nov 20 '05 #2

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

Similar topics

2
by: MONO | last post by:
Hello! I´m trying to get the weeknumber fom a given date but at some dates will return the wrong weeknumber. WeekNumber = DatePart("ww", TodayAsDate, vbMonday, vbFirstFourDays) like...
1
by: Jozua | last post by:
Hi Can anybody please help. I require a user to select a date on a JavaScript calendar. Based on the date selected by the user the system must determine which YEAR and WEEKNUMBER the user has...
1
by: Vanessa | last post by:
Does anyone know whether when I select a weeknumber of a certain year, eg. 2004, the date from first day to the last day of the week will be known. Regards Vanessa
1
by: Vanessa | last post by:
Does anyone know whether when I select a weeknumber of a certain year, eg. 2004, the date from first day to the last day of the week will be known. Regards Vanessa
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.