简体   繁体   中英

how convert Georgian calendar to Persian calendar in c#

i convert Georgian calendar to Persian calendar by this code:

PersianCalendar t = new PersianCalendar();
date = t.GetYear(DateTime.Now).ToString("0000") + "/" + t.GetMonth(DateTime.Now).ToString("00") + "/" + t.GetDayOfMonth(DateTime.Now).ToString("00");

its work fine in application but when run app in windows 10 and location in Persian this code not work fro example: when system date time this 2019/07/27 return 1398/05/05 but when system date time is 1398/05/05 return 2019/07/27 i want always return 1398/05/05 how fix it?

I can tell you i tested your code and didn't find anything wrong with it. However you might want to check this answer by Jon Skeet in a similar question.

https://stackoverflow.com/a/11222462/5797040

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM