爲一個字符串波斯日期轉換爲公曆DateTime
, 我使用日期時間選擇器,並將其發送我像"۱۳۹۴/۰۲/۲۰"
將字符串轉換波斯日期公曆日期時間
PersianCalendar p = new PersianCalendar();
string[] d = start.Split('/');
DateTime dt = new DateTime(int.Parse(d[0]),
int.Parse(d[1]),
int.Parse(d[2]),
new HijriCalendar());
和我的函數轉換字符串被
public static DateTime ToGregorianDate(this DateTime dt)
{
PersianCalendar pc = new PersianCalendar();
return pc.ToDateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, 0);
}
它給DateTime
我怎麼能發送正確DateTime
當它要顯示轉換此錯誤:
Input string was not in a correct format.
'DateTime'構造函數以整數作爲參數,它們在.NET Framework中表示爲[阿拉伯數字](http://en.wikipedia.org/wiki/Arabic_numerals)。 –