
How to change the timezone that a cloud function with dart-runtime uses when creating DateTime objects? I have already changed the timezone fo the host, appwrite seems to have its own timezone configured?

Changing timezone in cloud function runtimes..

Can you expand further on what you're trying to do and what's going on?
When server-side, you should always work in UTC

I have a cloud function that runs on the dart-runtime. There I use DateTime objects to make changes. The created DateTime objects are three hours behind my local timezone

At first I thought the dart runtime reflects the system's timezone, just as how it does so on my own machine, but on appwrite it seems to be somewhat diffeernt

What exactly are you doing with the datetime objects? You should probably be doing DateTime().toUtc()

Already doing that. I use the DateTime object to query based on the local timezone

.toUtc() still returns the time that is behind my timezone

What do you mean?

Sorry if I have not been clear.
The cloud function uses the current DateTime (the time it gets triggered) and uses it to find the documents that belong to the same DateTime (that's; $createdAt attribute). And the problem is that the DateTime in my dart runtime is three hours behind my local timezone, so whenever users trigger that function in the local timezone, the queried result will be inaccurate since it's going to be based on a DateTime with a different timezone. I hope it's clear

Belong to the same timezone? What do you mean? Can you explain in more detail what you're trying to do?

Let's say my documents are created at different times in day 1, And a user wants to query to the documents at a specific time, for that the user calls a cloud function to do that for him.. the cloud function does not take any input from the user but rather uses the current time it gets triggered and queries the docs per that.

when the cloud function uses the current datetime, the result is not going to be the same as if the user has passed into the function its dateTime

because as I described previously, in my console the DateTime (if I print out thru the dart runtime) appears 3 hours behind the time zone I need to operate in

I'm currently just doing res.json({
'areDevelopersAwesome': DateTime.now().toUtc().toString(),
});
in my cloud function and the dateTime ain't the same as my host

Did I make the use-case clearer? @Steven

The user must supply the input

it seems to be the way I shall go with

I will go this way now. I appreciate the time you took here 👋
Recommended threads
- custom requirements.txt file
How do I specify a custom requirements.txt file when creating a serverless function through the Appwrite console?
- Is my approach for deleting registered u...
A few weeks ago, I was advised not to use the registered users' id in my web app. Instead, I store the publicly viewable information such as username and email ...
- ❗[Help] Function stuck in "waiting" stat...
Hi Appwrite team 👋 I'm trying to contribute to Appwrite and followed the official setup instructions from the CONTRIBUTING.md guide to run the platform locall...
