Add Jalali month to Jalali date

I have a date in Jalali (Persian Date system) that I need to send 1 month. The problem is that when I add 1 month using myDateTime.AddMonths(1) my date is ahead by 1 Gregorian month, whereas I want Jalali month.

For example, if my date (format: yyyy-MM-dd) is 2013-02-28 in Gregorian and 1391/12/10 Jalali, and I add one month it will be 2013-03-28 in Gregorian (this is good) and 1392 / 01/08 (this is wrong and should be 1392/01/10).

Having told the whole story above, is there a way to add one month to a date based on my culture or region or something like that?

+4
source share
1 answer

You can use instance methods of System.Globalization.PersianCalendar (which largely behave like static methods), for example:

 var persianCalendar = new System.Globalization.PersianCalendar(); var today = DateTime.Today; var nextMonth = persianCalendar.AddMonths(today, 1); 
+9
source

All Articles