error - convert date to showing in view

Posted by Ali on Stack Overflow See other posts from Stack Overflow or by Ali
Published on 2010-05-01T08:07:19Z Indexed on 2010/05/01 8:17 UTC
Read the original article Hit count: 360

Filed under:

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) )%> 

© Stack Overflow or respective owner

Related posts about asp.net-mvc