DEV Community

Discussion on: JavaScript Dates in SQL

Collapse
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.

Collapse
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.