How to get last week’s number in string or int format?
Ex : The current week number is 46 and expected output is 45
How to get last week’s number in string or int format?
Ex : The current week number is 46 and expected output is 45
One of many options
Please try the following expression:
currentWeekNumber = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
DateTime.Now,
CalendarWeekRule.FirstFourDayWeek,
DayOfWeek.Monday)
And then, you check this:
If currentWeekNumber = 1 Then
lastWeekNumber = 52
Else
lastWeekNumber = currentWeekNumber - 1
End If
Hope this helps,
Best Regards.
cint(math.round(now.DayOfYear/7))-1
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.