Set the TimeZone on Digital Ocean docker?

Set the TimeZone on Digital Ocean docker?

I have used a .env file for local dev to set the time zones.

But now that the “Docker” is live on DO… how does one … set the timezone in DO…?
Can one do this via the UI?

Is this DO droplet configured using Wappler’s built-in Docker deployment options?

Yes… mmm… maybe im missing the point then :slight_smile: :slight_smile: as im have {{NOW_UCT}} in my globals and was hopeing that outputs that time…

server-time-now

This is what that ouputs… I thought that would then output the “server” time that was set as UCT +2
output-time-UTC-Now|260x74

The time in the database is also…
2022-03-15 12:15:00 ----> but shows as
2022-03-15T10:15:00.000Z on

NOW_UTC returns the current time in the UTC time zone: https://www.timeanddate.com/worldclock/timezone/utc

Ok… 100% … but then how would i display the “Local time” from the server above? The server time?

Sorry i thought because i set the server (docker timezone) to +2 time zone… then its supposed to do that… how will i then achieve getting the current docker server time?

The time in the database is also…
2022-03-15 12:15:00 ----> but shows as
2022-03-15T10:15:00.000Z … 2 hours behind… i was expecting when i set the Time Zone to plus to … ti would show up as 2022-03-15T12:15:00.000Z ?

SO i guess my question is … how do i get the time from the sever that is set +2 … (my time zone)

Well use NOW instead, it shows the server time.

thanks Teodor… … let me have a go… sorry misunderstood it completely…

But i still have the problem where my date and time is 2 hours behind the datbase time… … should i convert these to UCT time… eg… {{start_date.toUTCDate()}}

still confused… as in my database i have a time as 2022-03-15 12:15:00

My “server” time is supposed to be set to Johannesburg +2

But if i do a normal query just importing the date it shows as
2022-03-15T10:15:00.000Z should this not be 2022-03-15T12:15:00.000Z ??? why would it revert back to UTC 0 and not use UTC as set on the digital ocean droplet

or does one have to “set” the timezone of the database as well … lol… asking stupid question again…

The reason for my stupid question… on local dev you can select a timezone…
localhost-you-can-set-the-timezone

But on the DOCKER remote you cannot set a time zone for the database…

Just for curiosity, do this SQL query on the VPS:

SELECT NOW()

Should give you time in the timezone you want. If not, try:

By the way, there are some users lurking around complaining about date issues, so you might be running into one of those bugs

(I think those users are scalaris and jellederijke)

thank you Apple… :green_apple: :apple: :green_apple: :apple:

My start_time in my database is “start_time”… 2022-03-15 12:15:00 (mysql)

If I add it to the page eg {{start_date}} then it outputs 2022-03-15T10:15:00.000Z
I was hoping it would take the “Timezone” into consideration… because if i change the timezone to Africa/Johannesburg on the Docker… then surely it should then work??? As if the server and database is in Johannesburg… GMT +2

The only work around for me now… to force the UTC date to use my timezone is
{{(start_date.addHours(2).toUTCDate()).replace('T', ' ').replace('.000Z', '')}}
This will then output 2022-03-15 12:15:00 but that is going to bite me in the butt somewhere …

So the question still remains… if i change the the TIMEZONE on the docker container… then it should give me the output of that timezone and not change my database entry to something else…as the time in that database is already correct 2022-03-15 12:15:00 but … when it “queries” and outputs the result it shows… 2022-03-15T10:15:00.000Z (back to the London +0 timezone)

I have done the SELECT NOW()

And the database time is showing (UTC +0) …
database-time-is-out

Ok going to see if i cant set the the date with sql…

Ok i have managed to update the database…
SET GLOBAL time_zone = "Africa/Johannesburg";

But still the date renders the date as if im in London.
changed-but-still-no-diffrence-on-output-of-date

The data in the database
database-entry

i have restarted docker… re-deployed… but still it shows … as if im in London… eishhh…

This is the the raw code… to show how … i do the bindings…

@psweb did you do anything like this … because you are a “local” :slight_smile: :slight_smile:

Ok... I found the solution..!! :slight_smile: :slight_smile:

by default if you bring in a date ... it will use the UTC time..
{{start_date}} ---- > 2022-03-15T14:35:00.000Z

But if you use the date formatter it will take the time and correct it
{{start_date.formatDate('yyyy-MM-dd HH:mm:ss ')}} ----> 2022-03-15 16:35:00

So all good now.. thanks all for the responses.. @Apple for letting me check the SQL Date... :slight_smile: