Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

222
Vistas
How to display DateTime when using a datatable?

I am building a web app in ASP.NET Core using Razor Pages. However, i also wanted to try using some javascript to display a datatable. I want to display the properties StartTime, EndTime, and Added, which are of the type DateTime. But i cannot get it to work without doing a lot of background conversions.

My question is, what would be the simplest way to display the values stored in the DateTime properties?

This is what my js-file looks like, it displays information from an object of the custom class Shift:

$(document).ready(function () {

    
    $('#DT_load').DataTable({
        "ajax": {
            "url": "/api/Shift",
            "type": "GET",
            "datatype":"json"
        },
        "columns": [
            { "data": "user.name", "width": "25%" },
            { "data": "location.name", "width": "25%" },
            {**<!-- Here i want to display DateTime properties values -->**
                "data": "id",
                "render": function (data) {
                    return `<div class="w-75 btn-group" >
                            <a href="/Admin/Shifts/upsert?id=${data}" class="btn btn-success text-white mx-2">
                            <i class="bi bi-pencil-square"></i> </a>
                            <a href="/Admin/Shifts/upsert?id=${data}"  class="btn btn-danger text-white mx-2">
                            <i class="bi bi-trash-fill"></i> </a>
                            </div>`

                },
                "width":"15%"
            },
        ],
        "width":"100%"
    });
});

I am using a controller that gets all properties with specific properties, but including the properties doesn't work either.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda