[AccessD] Figuring the date

Drew Wutka DWUTKA at Marlow.com
Fri Mar 6 16:46:38 CST 2009


Function MondayDate(intYear As Long, intWeek As Long)
MondayDate = DateSerial(intYear, 1, 1 + (7 - Weekday(DateSerial(intYear,
1, 1), vbTuesday))) + (7 * (intWeek - 1))
End Function

Watch for word wrap there, the code inside that function should be all
one line.

It's the date of January 1st of whatever year, offset by when the first
Monday is, the 7-Weekday bit, plus 7*one less then the number of weeks.

So if you put MondayDate(2009,1), you'll get 1-5-2009, the first Monday
of the year.  MondayDate(2009,52) and you'll get 12-28-2009, the last
Monday of the year.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer
Gross
Sent: Friday, March 06, 2009 2:38 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Figuring the date

Okay, I have answers to my questions - they define Week 1 as the first
full week of the year and the week is defined as Monday to Sunday.  Any
thoughts on how to get that Monday date when I know the year and the
week #?

Jennifer

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer
Gross
Sent: Friday, March 06, 2009 12:34 PM
To: AccessD List
Subject: [AccessD] Figuring the date


Hey Everyone,

I have two pieces of information - the year and the week # within the
year, for instance 2008 13 is the 13th week in 2008.  I have questions
out to the client about how they define the week (Sun-Sat, Mon-Sun) and
how the first week of the year is defined - week that January 1 falls in
or first full week of the year.  Anyway - what I need to do is create a
function, unless one already exists, when fed these two pieces of
information returns the Monday date (short date format) for that week.  

Any help is appreciated.

Jennifer

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.11.8/1986 - Release Date:
03/05/09 19:32:00


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list