Date of Monday in the current week


#1

Hi all,

How can i get the date of Monday in current week?

For Example,
Today date is 29-03-2018.
I want this week Monday date 26-03-2018

Regards,
Abishek


#2

@Abishek

In assin activity use this

today = today.now.AddDays(-((now.DayOfWeek - System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek + 6) Mod 7)).Date


#3

Hi @Abishek,

Use this one
strMonday=DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString()

Regards,
Arivu


#4

@Abishek,PFA dates.xaml (15.7 KB)
Thanks,
sreekanth.k


#5

Hi @arivu96,

The solution which u gave is working fine. Thank You.
Now i have one more query.

How to get date of last week’s Tuesday?
For Eg: I want Tuesday of lastweek (20-03-2018)

Regards,
Abi


#6

Hi @Abishek,

strTuesday=DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek.Tuesday)) mod 7).Date.ToString()

last Tuesday

strTuesday=DateTime.Now.AddDays(-7).AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek.Tuesday)) mod 7).Date.ToString()

Regards,
Arivu