InertiaM
Well-known member
In VB6, I used to use
What's the VB.NET logic equivalent? I've tried
but it gives different answers
VB.NET:
DateDiff("ww", DateSerial(Year(Now), 4, 5), Now)
What's the VB.NET logic equivalent? I've tried
VB.NET:
Convert.ToInt32(Math.Floor((Date.Now - New Date(Date.Now.Year, 4, 5)).TotalDays / 7) + 1)
but it gives different answers
VB.NET:
Dim dtDateToCheck As Date
Dim iFW_VB6 As Integer = 0
Dim iFW_VBdotNET As Integer = 0
For i As Integer = -5 To 100 'days backward to days forward to check
dtDateToCheck = Date.Now.AddDays(i)
iFW_VB6 = Convert.ToInt32(Microsoft.VisualBasic.DateDiff("ww", New Date(dtDateToCheck.Year, 4, 5), dtDateToCheck))
iFW_VBdotNET = Convert.ToInt32(Math.Floor((Date.Now - New Date(Date.Now.Year, 4, 5)).TotalDays / 7) + 1)
If iFW_VB6 <> iFW_VBdotNET Then
MessageBox.Show(dtDateToCheck.ToString & Environment.NewLine & iFW_VB6.ToString & " does not agree with " & iFW_VBdotNET.ToString)
Exit Sub
End If
Next
MessageBox.Show("All values match!")