I have a date in Jalali (Persian system of Date) which I need to be forwarded 1 month. The problem is that when I add 1 month using myDateTime.AddMonths(1)
my date forwards by 1 Gregorian month, whereas I want a Jalali month.
For example if my Date (Format: yyyy-MM-dd) is 2013-02-28 Gregorian and 1391/12/10 Jalali, and I add one month it will be 2013-03-28 Gregorian (that is alright) and 1392/01/08 (that is wrong and should be 1392/01/10 ).
Having said all the story above, is there a way I can Add one month to a date based on my culture or region or something?
You can use System.Globalization.PersianCalendar
instance methods (which pretty much behave like static methods), as in:
var persianCalendar = new System.Globalization.PersianCalendar();
var today = DateTime.Today;
var nextMonth = persianCalendar.AddMonths(today, 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With