[英]Convert Date from Persian to Gregorian
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用 System.globalization.PersianCalendar 将波斯日期转换为公历日期? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我想转换我的波斯日期(例如今天是 1391/04/07)并获得公历日期结果,在本例中为 06/27/2012。 I'm counting seconds for an answer...
我正在数秒以求答案...
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用System.globalization.PersianCalendar将波斯日期转换为公历? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我要转换我的波斯日期(例如今天是1391/04/07),并获得格里高利日期结果,在这种情况下,结果将是06/27/2012。 I'm counting seconds for an answer ...
我在数秒以内的答案...
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用System.globalization.PersianCalendar将波斯日期转换为公历? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我要转换我的波斯日期(例如今天是1391/04/07),并获得格里高利日期结果,在这种情况下,结果将是06/27/2012。 I'm counting seconds for an answer ...
我在数秒以内的答案...
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用System.globalization.PersianCalendar将波斯日期转换为公历? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我要转换我的波斯日期(例如今天是1391/04/07),并获得格里高利日期结果,在这种情况下,结果将是06/27/2012。 I'm counting seconds for an answer ...
我在数秒以内的答案...
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用System.globalization.PersianCalendar将波斯日期转换为公历? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我要转换我的波斯日期(例如今天是1391/04/07),并获得格里高利日期结果,在这种情况下,结果将是06/27/2012。 I'm counting seconds for an answer ...
我在数秒以内的答案...
How can I convert Persian date to Gregorian date using System.globalization.PersianCalendar?如何使用System.globalization.PersianCalendar将波斯日期转换为公历? Please note that I want to convert my Persian Date (eg today is 1391/04/07) and get the Gregorian Date result which will be 06/27/2012 in this case.
请注意,我要转换我的波斯日期(例如今天是1391/04/07),并获得格里高利日期结果,在这种情况下,结果将是06/27/2012。 I'm counting seconds for an answer ...
我在数秒以内的答案...
Create Persian Calendar as html helper with tag builder c# , and convert selected persian date to gregorian date使用标签生成器 c# 创建波斯日历作为 html 助手,并将选定的波斯日期转换为公历日期
Visit https:\/\/github.com\/tarqawwad\/Persian-Calendar<\/a>访问
https:\/\/github.com\/tarqawwad\/Persian-Calendar<\/a>
To convert from Gregorian date to Persian(Iranian) date:
string GetPersianDateYear(string PersianDate)
{
return PersianDate.Substring(0, 4);
}
string GetPersianDateMonth(string PersianDate)
{
if (PersianDate.Trim().Length > 8 || PersianDate.IndexOf('/') > 0 || PersianDate.IndexOf('-') > 0)
{
return PersianDate.Substring(5, 2);
}
else
{
return PersianDate.Substring(4, 2);
}
}
string GetPersianDateDay(string PersianDate)
{
if (PersianDate.Trim().Length > 8 || PersianDate.IndexOf('/') > 0 || PersianDate.IndexOf('-') > 0)
{
return PersianDate.Substring(8, 2);
}
else
{
return PersianDate.Substring(6, 2);
}
}
var PersianDate = "1348/10/01";
var perDate = new System.Globalization.PersianCalendar();
var dt = perDate.ToDateTime(GetPersianDateYear(PersianDate))
, int.Parse(GetPersianDateMonth(PersianDate))
, int.Parse(GetPersianDateDay(PersianDate)), 0, 0, 0, 0);
install Nuget Package: Persian_Extention and use like this:安装 Nuget Package: Persian_Extention 并像这样使用:
DateTime StartDate= StartDateStr.ToGregorianDateTime();
Or
String StartDateStr = StartDate.ToShamsiDate();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.