How to convert a Persian date into a Gregorian date?

前端 未结 9 1262
萌比男神i
萌比男神i 2020-12-30 04:30

I use the function below to convert Gregorian dates to Persian dates, but I\'ve been unable to write a function to do the reverse conversion. I want a function that converts

9条回答
  •  [愿得一人]
    2020-12-30 05:10

    You may try with this: 
    
    using System.Globalization // namespace
    GregorianCalendar greg = new GregorianCalendar();
    DateTime DayYearMonth = new DateTime(1433, 10, 11, greg );
    
    Console.WriteLine(greg .GetDayOfMonth(DayYearMonth )); // 11
    Console.WriteLine(greg .GetYear(DayYearMonth )); // 1433
    Console.WriteLine(greg .GetMonth(DayYearMonth )); // 10
    

提交回复
热议问题