I have ASP.NET MVC project and I am trying to format date (dd/MM/yyyy) in my cshtml UI but its returning null.
Below is my cshtml code:
<tr ng-repeat="item in items">
<td>{{item.Id}}</td>
<td>{{item.Name}}</td>
<td>{{item.Manufacturer}}</td>
<td>{{item.BatchNo}}</td>
<td width="50px">{{item.ExpiryDate| date: 'dd/MM/yyyy'}}</td>
</tr>
I tried two ways:
1) formatting in .NET cshtml itself but nothings happening:
<td width="50px">{{item.ExpiryDate| date: 'dd/MM/yyyy'}}</td>
2) I tried using filter but its returning null:
medApp.filter('cmdate', [
'$filter', function ($filter) {
return function (input) {
return $filter('date')(new Date(input), 'dd/MM/yyyy');
};
}
]);
code in cshtml:
<td width="50px">{{item.ExpiryDate| cmdate: 'dd/MM/yyyy'}}</td>
Any clue about the issue?
Thanks