Hi
How to write datetime function for adding oneyear and 90 days ago to the currentdate
Thanks
Karthik
Loading
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.
VulpesPosted Nov 22, 2011, 6:41 AM
SELECT DATEADD(day, -90, DATEADD(year, -1, GETDATE()))
VulpesPosted Nov 22, 2011, 9:35 AM
karthik parchaPosted Nov 22, 2011, 9:22 AM
when i execute your query
getting following output
2010-08-24 08:21:23.040
i want to show here date as 01 by default
plz help me
karthik parchaPosted Nov 22, 2011, 9:19 AM
VulpesPosted Nov 22, 2011, 6:51 AM
Pravin MorePosted Nov 22, 2011, 6:49 AM
Pravin MorePosted Nov 22, 2011, 6:47 AM
if want it for SQL Server then here is query...........
select DATEADD(day,-90,DATEADD(MM,-12,GETDATE()))
Thanks,
Pravin.
Prabhu RajaPosted Nov 22, 2011, 6:43 AM
Prabhu RajaPosted Nov 22, 2011, 5:52 AM
Try to post Answers that differ from previous thread. So, that be will really helpful.
Datta KharadPosted Nov 22, 2011, 5:46 AM
DateTime dtm = DateTime.Now.AddYears(-1).AddDays(-90);
Prabhu RajaPosted Nov 22, 2011, 5:40 AM
Label1.Text = DateTime.Now.AddYears(-1).AddDays(-90).ToString();