2016-08-14 43 views
2

我將Giorgione Date存儲在數據庫中,並且必須向用戶顯示Persian Date。我寫這個,但發生錯誤。如何將格魯吉亞日期從數據庫轉換爲波斯日期在剃刀視圖? - Asp.net MVC

@foreach (var item in Model) { 
    @General.PersianNumDate(Convert.ToDateTime(Html.DisplayFor(modelItem => item.PostDate))) 
} 

錯誤:

System.InvalidCastException: Unable to cast object of type 'System.Web.Mvc.MvcHtmlString' to type 'System.IConvertible'.

我怎麼能轉換PostDate從格魯吉亞到波斯?

回答

2

我找到的解決方案:

@General.PersianNumDate(Convert.ToDateTime(item.PostDate)) 
相關問題