Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
¿Cómo agregar tiempo a CURRENT_TIMESTAMP en knex.js?

Tengo tal declaración knex :

 return knex(table).insert({ id: uuid.v4(), ...data, created_at: knex.raw('CURRENT_TIMESTAMP'), updated_at: knex.raw('CURRENT_TIMESTAMP'), expired_at: ... })

Hay 3 campos de marca de tiempo created_at , updated_at y expired_at . No hay problema con 2 primero, pero no tengo idea de cómo agregar expired_at como +1 minuto.

En pseudocódigo me vería así:

expired_at: knex.raw('CURRENT_TIMESTAMP + 1 minute')

Entonces, ¿cómo puedo agregar tiempo usando CURRENT_TIMESTAMP ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

puede usar knex.fn.now() para ejecutar la función CURRENT_TIMESTAMP en la base de datos y deberá usar los métodos integrados de mysql para calcular su fecha futura

eche un vistazo a las funciones de fecha de mysql en el documento oficial

por ejemplo:

 knex.raw('SELECT date_add(?, INTERVAL ? day)', [knex.fn.now(), 1])
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!