Mehrdad
Mehrdad

Reputation: 41

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?

Upvotes: 1

Views: 436

Answers (1)

Tasos Kokkinidis
Tasos Kokkinidis

Reputation: 76

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

Upvotes: 1

Related Questions