Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21867

getting Current week no from system date

$
0
0
Can anyone tell me ? .How should i get current weekno on the basis of sytem date .let me know please .any help would be highly appreciated .
Code:



Option Explicit

Private Sub Command1_Click()
GetCurentWeekNo (Now)
End Sub

Public Sub GetCurentWeekNo(CurDate As Date)
Dim myDate As Date
myDate = Format(CurDate, "dd/mm/yyyy")
Dim mYear As Integer
Dim mMonth As Integer
Dim mDay As Integer
mYear = Format(myDate, "YYYY")
mMonth = Format(myDate, "mm")
mDay = Format(myDate, "dd")
Dim dteStartOfYear As Date
Dim dteWorkingDate As Date
Dim intWeeks As Integer
    dteStartOfYear = DateSerial(2012, 7, 1)
    dteWorkingDate = DateSerial(mYear, mDay, mMonth)
    intWeeks = DateDiff("ww", dteStartOfYear, dteWorkingDate)
   
    MsgBox intWeeks
End Sub


Viewing all articles
Browse latest Browse all 21867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>