error - convert date to showing in view
- by Ali
hi
i need convert date to shamsi date
i create a method that convert DateTime to shamsi Date.
when i passing a date to the method i got this error
The best overloaded method match for 'BentaAccounting.Classes.GenralClasses.FarsiDate.MiladiToShamsi(System.DateTime)' has some invalid arguments
this is the code i am using
the method
public static string MiladiToShamsi(DateTime Date)
{
string Result;
PersianCalendar FarsiDate = new PersianCalendar();
Result = FarsiDate.GetYear(Date).ToString() + "/" +
(FarsiDate.GetMonth(Date) < 10 ? "0" + FarsiDate.GetMonth(Date).ToString() : FarsiDate.GetMonth(Date).ToString()) + "/" +
(FarsiDate.GetDayOfMonth(Date) < 10 ? "0" + FarsiDate.GetDayOfMonth(Date).ToString() : FarsiDate.GetDayOfMonth(Date).ToString());
return Result;
}
and view
<%: Html.Encode(GenralClasses.FarsiDate.MiladiToShamsi(item.OrderDate) )%>