0

In Mvc how to display DateTime in Date Format Like 1/1/2015 12:00:00 AM, This Date Format I Wana to show 1/1/2015

<table id="table_id">

    <thead>
        <tr>
            <td>EmpId</td>
</tr>
    <tbody>

     @foreach (var ee in Model.GetEmployeeFromHybridge)
            { <td>@ee.date</td>}
    </tbody>
  $(document).ready(function () {
        $('#table_id').dataTable();

    })

1 Answers1

0

You can just format a dateTime with .ToString("dd/MM/yyyy");

Be sure your field type is DateTime.

Here's a link showing way to format date and time. https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

Alex Stephens
  • 3,017
  • 1
  • 36
  • 41