DEV Community

Discussion on: JavaScript Dates in SQL

memodev07 profile image
Guillermo Arias

The last example won't work when the date is in the next day and my timezone is still today.

induratized profile image
Abhinav Sharma

I guess Benjamin gave his Zone example with ISO.
You can use

${d.getDate()}-${d.getMonth()+1}-${d.getFullYear()} d.toTimeString().split(' ')[0]

, where d = new Date() , to get the local result.