Date and hour in wappler

I’m not understanding how the date and time works in wappler for my country,
1 - my date and time in brazil: img

2 - my date in database: db

3 - in list with formatting, shows one day and hour less: format_dd-MM-yyyy

4 - without format: no_format,

I would like you to keep this in my database and or timezone.

thanks.

What type of field are you storing the the value to? Datetime?
How do you store it, at database level or via wappler insert/ update action
Where is your sever located

hello, the field type and date, and I’m using mysql, both in insert and update

thank you very much, Teodor.

Need to make that date time field

1 Like

thansk. :handshake:

Because NodeJS/Knex applies ‘Z’ to the no-timezone date-time values returned from the DB server, when you apply date formatter on client side, it gets converted to your local system time.
‘Z’ denotes that the date time value is UTC timezone. So when you use Wappler’s date formatter, it automatically tries to convert it to your local OS’s timezone.

Add a replace formatter to remove Z, and then apply date formatter.
data.expiration.replace('Z','').formatDate('dd-MM-yyyy HH:mm')

1 Like

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 :
Captura de pantalla 2023-09-24 a la(s) 11.05.08

Server-Side Value from Query Screenshot :
Captura de pantalla 2023-09-24 a la(s) 11.05.43

Server-Side Transformation Screenshot :
Captura de pantalla 2023-09-24 a la(s) 11.06.32

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:

  1. Could there be any internal settings or configurations that might be affecting this?
  2. 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.

Carlos

Have you seen:

1 Like

But if my Database and App are configured for Local Timezone, why is Wappler substracting my -3 timezone? I mean, I need to use values as the are being showed in my database, without changing values.