Hi
I have below value in Database . It is DateTime field. Database is Sql. I want to add 2 weeks in Date , other values remain same.
2023-04-01 15:15:00.000
Thanks
Hi
I have below value in Database . It is DateTime field. Database is Sql. I want to add 2 weeks in Date , other values remain same.
2023-04-01 15:15:00.000
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh KumarPosted Mar 31, 2023, 9:40 AM
Hello Ramco,
below one is correct, if you are using .AddDays() method it will not change time. it only adds days, beloow one only adds number of weeks which you have selected from dropdown
Ramco RamcoPosted Mar 31, 2023, 6:37 AM
Hi
How to do in c#. I want chane only Date Time Values should remain same.
Thanks
Rajkiran SwainPosted Mar 31, 2023, 6:33 AM
Ramco RamcoPosted Mar 31, 2023, 6:11 AM
Hi
I am trying below cide. Is it ok
Rec.SessionDate = Convert.ToDateTime(Rec.SDate).AddDays(7*Convert.ToInt32(ddlWeeks.SelectedValue));
I want to change only date. Time should remain same. With above code it is changing tome to 0.
Thanks
Jignesh KumarPosted Mar 31, 2023, 6:08 AM
Hello Ramco,
You can use DateADD() function to do this, please try below,