How to get previous week number of the year

Hello All,

I would like to how to get the previous week of the year from the current week of the year.

i.e if This is week is no 11 I want to get week no 10.

Hi @Yugal_Raju ,

Is this what you were referring to?

image

System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(Today.AddDays(-7),System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Monday)

Kind Regards,
Ashwin A.K

Hi @Yugal_Raju

Try this expression

CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(DateTime.Now,CalendarWeekRule.FirstDay,DayOfWeek.Monday)

Regards
Gokul

Hi

To get the week number

int week_number = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(Datetime.Now, currentCulture.DateTimeFormat.CalendarWeekRule,currentCulture.DateTimeFormat.FirstDayOfWeek)

For more details on Datetime

Cheers @Yugal_Raju

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.