Hi
DateTime frDate = Utility.CurrentDateTime().AddMonths(-1);
frDate = Convert.ToDateTime(frDate).ToString("dd-MM-yyyy");
Thanks
Hi
DateTime frDate = Utility.CurrentDateTime().AddMonths(-1);
frDate = Convert.ToDateTime(frDate).ToString("dd-MM-yyyy");
Thanks
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
Uday DodiyaRank #239 · 10.3K reputationPosted Sep 21, 2022, 3:19 AM EDT
Hi Ramco,
Try Following
Solution 1
DateTime frDate = Utility.CurrentDateTime().AddMonths(-1); frDate = Convert.ToDateTime(frDate.ToString("dd-MM-yyyy"));Solution 2
DateTime frDate = DateTime.Now.AddMonths(-1); frDate = Convert.ToDateTime(frDate.ToString("dd-MM-yyyy"));Ramco RamcoRank #462 · 5.4K reputationPosted Sep 21, 2022, 3:31 AM EDT
Hi Uday
I want frDate only in Date format dd-MM-yyyy .
Current it is showing time also with 00:00;00
Thanks
Uday DodiyaRank #239 · 10.3K reputationPosted Sep 21, 2022, 3:42 AM EDT
Hi ramco,
In datetime datatype its default format is dd/MM/yyyy 00:00:00
we can get dd-MM-yyyy as string as follows
Solution 1
DateTime frDate = Utility.CurrentDateTime().AddMonths(-1); String strfrDate = frDate.ToString("dd-MM-yyyy");Solution 2
DateTime frDate = DateTime.Now.AddMonths(-1); String strfrDate = frDate.ToString("dd-MM-yyyy");You can get your date format "strfrDate" variable