Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parameter.value.getTime is not a function while saving date to database

I am saving the date to SQL database from nodejs. While saving the date to SQL I am getting error " parameter.value.getTime ".

While passing a date in this format while passing it to SQL.

2018-06-27T18:30:00.000Z

In early records in the database, DateTime format is this one.

2018-05-25 14:39:19.433

How can I solve this error? I already used moment js to use another format for saving the date but it is not working.

like image 725
Aarsh Avatar asked Dec 24 '22 06:12

Aarsh


1 Answers

You should not try to change the format of your String, but convert it into JavaScript Date instead:

var yourDate = new Date(yourString);
like image 193
Guerric P Avatar answered Jan 13 '23 23:01

Guerric P