Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

220
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda