I
I
ince2019-01-31 17:50:34
Oracle
ince, 2019-01-31 17:50:34

Date issue in node.js and Oracle?

Connected to the database and trying to add a record with a date

...
 // maxId = 0
 // d = '31.01.2019 17:20:31'
connection.execute(
                   `INSERT INTO AVG_PRICE_HISTORY (ID_RECORD, DATETIME) VALUES (:id, TO_DATE(:dt))`,
                    {id: maxId+1, dt: d},
                    ...

Stumbles on date - the format is not pleasant
ORA-01843: not a valid month
How to treat? (DATETIME has a Date type in the base)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Y, 2019-01-31
@ince

TO_DATE(:dt, 'DD.MM.YYYY HH24:MI:SS')
And the space in the value before 31 is superfluous:// d = '31.01.2019 17:20:31'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question