Home > database >  pull a number From the record to the number
pull a number From the record to the number

Time:09-07

how to pull a number out of day (columns in a day)
the date, but I need to display the records for a day (number)
doesn't help lenght
console.log(day.lenght) -> fake number sends use mysql2

        const day = rows[1].createdAt   moment().startOf("day").toDate()
        const week = rows[0].createdAt   moment().startOf("week").toDate()
        const month = rows[0].createdAt   moment().startOf("month").toDate()

CodePudding user response:

You can use a map function to return an array of dates from the rows array

const day = rows.map(function(row) {
   return row.createdAt   moment().startOf("day").toDate();
});
  • Related