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.

6
  • Please edit your question to show sufficient detail to be solvable. Specifically, we currently have no idea how your C# DateTime gets into Javascript. Commented Nov 20, 2020 at 9:01
  • Does this answer your question? Convert a Unix timestamp to time in JavaScript Commented Nov 20, 2020 at 9:04
  • @John Edit done. Thanks Commented Nov 20, 2020 at 9:08
  • @Akina no, in this case in the database the date is stored in datetime format. Commented Nov 20, 2020 at 9: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. Commented Nov 20, 2020 at 9:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.