0

I am having issues with my postgresql dates. I a column with type date. An example value in the column is 2016-01-28. However, when I make an AJAX request to retrieve data from the server, the date is returned as "2016-01-28T07:18:01.000Z". Does anyone know why the additional T07:18:01.000Z is there and how I can prevent it?

The only workaround I know is to use the dateformat package (https://www.npmjs.com/package/dateformat) to parse the date once it is returned from the AJAX request - but i'd rather not do it if I can return the date without the additional T07:18:01.000Z.

Here is my query:

knex('reports')
.where({
    projectid: req.params.id
})
.then(function(data) {
    console.log(data)
    console.log(data[0].start_date //returns "2016-01-28T07:18:01.000Z"
    res.send(data)
});

Thanks in advance!

2
  • Show us the SQL query that retrieves the data and the code that generates the JSON. Which programming language are you using? Commented Jan 28, 2016 at 20:27
  • @a_horse_with_no_name i updated my question w/ my query using the Knex ORM. I am using node.js Commented Jan 28, 2016 at 20:40

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.