Hello, I have a server action that returns AddMinutes (CurrDateTime (), 120), and consuming this return in a client action the value returned is changed without any action of mine for 5 hours and not 2 as it should be by the method described above, someone Have you seen anything like this?

Hi,

Could you post some screenshots or share your eSpace please?

Here is my server action assign:

the variable OutDataProxExec is an exit variable from my server action, this assing happens before the end of the method.


this is the section where we can see the server action described previously and the client action that consigns the variable of the same output:


In debugging I noticed that when entering the client action the time is changed soinha for 5 more hours and not two as previously added in the output variable of the server action.

Could you make a sample eSpace and share it. For now I see nothing wrong here.

Is there a timezone difference between your client app and the location of the server?
If so, you should give the currdatetime() from your client app as an input parameter for the server action and use that parameter / variable to add 120 minutes.

As a palaver, before the cosnumo of the time and date I'm fixing it, but I wanted to solve the error itself, i have implemented a server action that returns the current date and time, the return of this method is always 3 hours above the real in my locality, when checking the servers that allocate our applications, it was evaluated that the server time is correct, does curdatetime () have a relation to the locality, or do you evaluate something else?

Hi,

On the server you get to local time of the server and on the client you get the local time of the client device.

What is the time difference between your city and the city where the server is?

Johan den Ouden wrote:

Hi,

On the server you get to local time of the server and on the client you get the local time of the client device.

What is the time difference between your city and the city where the server is?

there is no difference


If you login into service center at the right you will find the date time.


What is the datetime there?
And what is de datetime from CurrDateTime() on the server action (do not addminutes to it).

Please debug the server action and see what CurrDateTime() returns there, not on the client.

Johan den Ouden wrote:

If you login into service center at the right you will find the date time.


What is the datetime there?
And what is de datetime from CurrDateTime() on the server action (do not addminutes to it).

Please debug the server action and see what CurrDateTime() returns there, not on the client.

server Date Time:

server action:

My client date Time:

Return of server action in a client action:

I'm  dont understand.. :)

Hello,

When sending date time variables to and from device (to from server), it is automatically changed based in the timezone.

This behaviour is not well documented, and it is different from what happens in Web, where this conversion does not happen.

Hope this help shed some light on the question.

Cheers

Hi Eduardo,

I think there is another problem here.
Normally the datetime is only converted when displaying it.
Here it is already converted in the client action.
Look at the code of Gulherme and my code in the debugger (my time is two hours different from the server):

In the server action:


In the client action (debugger):



On the alert (now it's converted):

Kilian Hekhuis wrote:

Without going through all the replies above, note that for mobile apps, all times are UTC, until the moment they are displayed on the screen. This means that both in the Server Action, and in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

So CurrDateTime() of a Server Action in a Mobile App returns the current date and time UTC, which as of writing this is 18:45. If you add two hours, you will get UTC+2, which means 20:45, which accidentally happens to be my local time (we're UTC+2 DST currently). However, when you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.


Thanks for the explication. Guilherme can you confirm this?

hi Guilherme,

Could you please provide a eSpace to see what is going on?

Johan den Ouden wrote:

Kilian Hekhuis wrote:

Without going through all the replies above, note that for mobile apps, all times are UTC, until the moment they are displayed on the screen. This means that both in the Server Action, and in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

So CurrDateTime() of a Server Action in a Mobile App returns the current date and time UTC, which as of writing this is 18:45. If you add two hours, you will get UTC+2, which means 20:45, which accidentally happens to be my local time (we're UTC+2 DST currently). However, when you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.


Thanks for the explication. Guilherme can you confirm this?


The problem is other than this I am afraid because the value of the datetime in and direct after the server action is different.

and

Solution

I have deleted my post above (couldn't edit it), since now that I'm sitting at work, I can test some more, and what I wrote it partially incorrect. This is what I think is really going on:

For Mobile Apps, all times are UTC, until the moment they are displayed on the screen. This means that in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

For Server Actions, whether it's a Server Action in a Web App or a Mobile App, the times are local server time. So it depends on the timezone the server lives in what time is returned.

So CurrDateTime() inside a Server Action returns the local current date and time. However, as soon as it is passed to the Client Action, it is in UTC. This explains the difference between them. When you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.

Solution

Kilian Hekhuis wrote:

I have deleted my post above (couldn't edit it), since now that I'm sitting at work, I can test some more, and what I wrote it partially incorrect. This is what I think is really going on:

For Mobile Apps, all times are UTC, until the moment they are displayed on the screen. This means that in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

For Server Actions, whether it's a Server Action in a Web App or a Mobile App, the times are local server time. So it depends on the timezone the server lives in what time is returned.

So CurrDateTime() inside a Server Action returns the local current date and time. However, as soon as it is passed to the Client Action, it is in UTC. This explains the difference between them. When you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.


Thanks Sir. Was looking for this explanation from so long and I was living with one serious issue. Going to fix my problem immediately. 


Johan den Ouden wrote:

Kilian Hekhuis wrote:

Without going through all the replies above, note that for mobile apps, all times are UTC, until the moment they are displayed on the screen. This means that both in the Server Action, and in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

So CurrDateTime() of a Server Action in a Mobile App returns the current date and time UTC, which as of writing this is 18:45. If you add two hours, you will get UTC+2, which means 20:45, which accidentally happens to be my local time (we're UTC+2 DST currently). However, when you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.


Thanks for the explication. Guilherme can you confirm this?


yep

Kilian Hekhuis wrote:

I have deleted my post above (couldn't edit it), since now that I'm sitting at work, I can test some more, and what I wrote it partially incorrect. This is what I think is really going on:

For Mobile Apps, all times are UTC, until the moment they are displayed on the screen. This means that in the Client Action that consumes the Server Action, you will see UTC in the debugger. That explains the 3-hour offset, as Contagem is UTC-3.

For Server Actions, whether it's a Server Action in a Web App or a Mobile App, the times are local server time. So it depends on the timezone the server lives in what time is returned.

So CurrDateTime() inside a Server Action returns the local current date and time. However, as soon as it is passed to the Client Action, it is in UTC. This explains the difference between them. When you display this time in an Expression, it's converted back to local time, which is why I would expect on your screen, without any other conversion client-side, you should see your local time + 2 hours.


thank you, i will fix it, but its so weird.. haha


Well, it's weird the first time you see it, that's true. But once you know that all Date Times are actually UTC when debugging a Mobile App (and when looking at data in the Local Storage), it's actually quite easy :).