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
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
In assin activity use this
today = today.now.AddDays(-((now.DayOfWeek - System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FirstDayOfWeek + 6) Mod 7)).Date
Hi @Abishek,
Use this one
strMonday=DateTime.Now.AddDays(-1*(7 + (DateTime.Now.DayOfWeek - DayOfWeek .Monday)) mod 7).Date.ToString()
Regards,
Arivu
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
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
it showing as tuesay is not member of string
how to get next week monday
it is getting current week monday,actually i need next week monday
Thanks a ton for this! Helped me just when required.
How to get next week Monday i.e if today is Monday - 06.07.2020 the next Monday date is 13.07.2020 and likewise if today is Tuesday - 07.07.2020 ,the next Monday date is 13.07.2020
Hi @arivu96
I want to get Date of Sunday of Current week as in my calendar Week Start day is Sunday. What modifications will i have to do in your solution?
Hi @arivu96
I want to get Date of Sunday of current week as my Week starts from Sunday.
What modification will i have to make in this?
Use below code to get Sunday date
Now.AddDAys(-1*Convert.ToInt32((7+(Now.DayOfWeek-DayOfWeek.Sunday)) mod 7)).Date
Regards,
Arivu