0

I have some variables of type Datetime stored, whose value when I debug is in the following format (for obvious reasons): 11/11/2020 00:00:00 and this way in the database: 2020-11-17 09:06:04.0

Everything ok with this, but when i try to print them on screen, in a tabla created with javascript, it seems like this:

enter image description here

The code of the table is:

                    self.cols = [
                        { field: "usuario", title: "Usuario", filter: { usuario: "text" }, sortable: "usuario", show: true },
                        { field: "fecha", title: "Fecha Inserción", filter: { fecha: "text" }, sortable: "fecha", show: true },
                    ];

fecha is the name of the datetime var.

EDIT: I am sending the data from C# by filling a list with the DB data. Then, in the function i return a json variable with that:

var json = Json(new
            {
                data = LstOrquestadorData,
                
            }, JsonRequestBehavior.AllowGet);

json.MaxJsonLength = 500000000;
return json;

In this, LstOrquestadorData is the name of the list.

Angel Gonzalez Pena
  • 145
  • 1
  • 1
  • 10
  • Please edit your question to show sufficient detail to be solvable. Specifically, we currently have no idea how your C# `DateTime` gets into Javascript. – ProgrammingLlama Nov 20 '20 at 09:01
  • Does this answer your question? [Convert a Unix timestamp to time in JavaScript](https://stackoverflow.com/questions/847185/convert-a-unix-timestamp-to-time-in-javascript) – Akina Nov 20 '20 at 09:04
  • @John Edit done. Thanks – Angel Gonzalez Pena Nov 20 '20 at 09:08
  • @Akina no, in this case in the database the date is stored in datetime format. – Angel Gonzalez Pena Nov 20 '20 at 09:08
  • 1
    You do not tell about storing. You tell about the output to the screen. Displayed values are timestamps (in ms) - convert them to datetime literal. Where they're converted - I cannot see. – Akina Nov 20 '20 at 09:10
  • Perhaps this: [*converting .NET DateTime object to Javascript Date object*](https://stackoverflow.com/questions/6472290/converting-net-datetime-object-to-javascript-date-object) – RobG Nov 23 '20 at 03:47

0 Answers0