Hello,
I’m encountering a similar issue related to time zones in my application, and I’m wondering if anyone else has faced a similar problem or could offer some insights into what might be going wrong.
The Issue:
I have a datetime value stored in my MySQL database, which is 2023-08-22 00:00:00
. However, when I use the formatDate('yyyy-MM-dd HH:mm:ss')
function on the server-side to transform this value, it gets converted to 2023-08-21 21:00:00
.
I’ve read the Date and Time Settings for NodeJS post and configured my non-Docker app to the OS Default and the Database to Local (because my date data should be shown regardless of the users’ time zone.
Database Value Screenshot :
Server-Side Value from Query Screenshot :
Server-Side Transformation Screenshot :
Time Zone Settings:
- MySQL Database time zone:
-03
- Node.js Server time zone (OS Default):
America/Buenos_Aires
- System time zone:
America/Buenos_Aires
Despite these settings, it seems like the formatDate
function is modifying the time zone or offsetting the time by 3 hours (the same difference between my Local Timezone and the UTC time).
Questions:
- Could there be any internal settings or configurations that might be affecting this?
- Are there any workarounds or fixes for this issue? I need the
formatDate
function to return the same value that is displayed when querying the database.
Thank you for your time, and I’m looking forward to any advice or insights you may have.