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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 22, 2011, 1:41 AM EST
SELECT DATEADD(day, -90, DATEADD(year, -1, GETDATE()))
Prabhu RajaRank #861 · 2.6K reputationPosted Nov 22, 2011, 12:40 AM EST
Label1.Text = DateTime.Now.AddYears(-1).AddDays(-90).ToString();
Datta KharadRank #2,135 · 668 reputationPosted Nov 22, 2011, 12:46 AM EST
DateTime dtm = DateTime.Now.AddYears(-1).AddDays(-90);
Prabhu RajaRank #861 · 2.6K reputationPosted Nov 22, 2011, 12:52 AM EST
Try to post Answers that differ from previous thread. So, that be will really helpful.
Prabhu RajaRank #861 · 2.6K reputationPosted Nov 22, 2011, 1:43 AM EST
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 22, 2011, 1:47 AM EST
if want it for SQL Server then here is query...........
select DATEADD(day,-90,DATEADD(MM,-12,GETDATE()))
Thanks,
Pravin.
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 22, 2011, 1:49 AM EST
VulpesRank #55 · 29.2K reputationPosted Nov 22, 2011, 1:51 AM EST
karthik parcha150 reputationPosted Nov 22, 2011, 4:19 AM EST
karthik parcha150 reputationPosted Nov 22, 2011, 4:22 AM EST
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
VulpesRank #55 · 29.2K reputationPosted Nov 22, 2011, 4:35 AM EST