-----Original Message-----
From: rasta_jom [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 10, 2005 11:15 AM
To: [email protected]
Subject: RE: [vbhelp] Week Date


Thanks Waqas for the very useful code,  but I have a small problem,  the
function will return '12/27/2004' for week 52 and year 2004.  I'm expecting
to get '12/20/2004'
for the Monday date.
My week 1 for 2005 starts at January 3.  jan 1 and 2 still falls at week 53.
Thank you so much.

Rasta




-----Original Message-----
From: Waqas Hussain [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 2:25 PM
To: [email protected]
Subject: Re: [vbhelp] Week Date


Copy-Paste the following function in a module and see if it helps:

<snip>

Public Function GetMondayDate(year As Integer, weekNum As Integer) As Date
Dim wkDay As Integer, tmpDt As Date tmpDt = DateAdd("ww", weekNum - 1,
DateAdd("d", -1, CDate("01-Jan-" & year))) wkDay = weekDay(tmpDt, vbMonday)
GetMondayDate = DateAdd("d", 8 - wkDay, tmpDt) End Function

</snip>


Waqas...



On Thu, 6 Jan 2005 10:20:11 +0800, rasta_jom <[EMAIL PROTECTED]> wrote:
> 
> Hello All,
> 
> I have a simple vb6 question, given is the week number and year, how 
> can i get the monday date of the week?
> 
> Rasta



'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links



 




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 1/3/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 1/6/2005
 

-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 1/6/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 1/6/2005
 



'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to