# Date field and date dataprovider is displayed incorrect

**URL:** <https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754>\
**Category:** Classic Servoy\
**Created:** [June 9, 2009, 11:37am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754 "2009-06-09T11:37:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 9, 2009, 11:37am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/1 "2009-06-09T11:37:06Z")

</div>

Hi,  
I am encountering this weird issue when running an application build for Servoy 3.5.7’s web client:  
I have a date field: format dd-mm-yyyy, and a date dataprovider: 1-05-1953. The same browser (including version), accessing the application from 2 different machines displays this date differently:

1. 1-05-1953
2. 30-04-1953  
So it extracts 1 day from the date.  
I am sure the date in the database is 1-05-1953, do you have an idea why this is happening?

Diana

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 9, 2009, 11:49am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/2 "2009-06-09T11:49:48Z")

</div>

check if both machines are on the same timezone!

(I think not ![;-)]( "Wink") )

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 9, 2009, 12:13pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/3 "2009-06-09T12:13:44Z")

</div>

Hi Harjo,

The servoy.use.client.timezone property is set to “false” in servoy-admin. To make sure you understand what i mean: there are 2 clients of the same application open: one on my PC,one from a remote server. Even if the dataprovider is 1-05-1953, the remote browser displays 30-04-1953. The same version of browser dispalys the data correct: 1-05-1953 on my local PC. Is there a setting that causes this to happen?  
Diana

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 9, 2009, 12:24pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/4 "2009-06-09T12:24:34Z")

</div>

yes, still check both timezones of both PC’s

are they the same?  
(if it is window, doubleclick in the rightbottom corner on the clock, choose the second tab)

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 9, 2009, 12:25pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/5 "2009-06-09T12:25:47Z")

</div>

ahh… it’s webclient!! ![:oops:]( "Embarassed")

hmmm that is weird,

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 9, 2009, 12:34pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/6 "2009-06-09T12:34:43Z")

</div>

They are different indeed:  
local: GMT+2  
remote: GMT+1  
Is there a way not to take this in consideration when displaying the date?  
Diana

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 9, 2009, 12:50pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/7 "2009-06-09T12:50:19Z")

</div>

oke, than it IS working the same as in a smart-client.

a date like 12-01-2009 00:00 set in GMT+2 will present like: 11-01-2009 23:00 in GMT+1 (this is standard behaviour)

do not exactly know, how you can prevent this.

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [June 9, 2009, 12:51pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/8 "2009-06-09T12:51:55Z")

</div>

look here: [http://forum.servoy.com/viewtopic.php?t=10806](http://forum.servoy.com/viewtopic.php?t=10806)

> Timezone Behavior Change  
> Important behavior change: by default, the property “servoy.use.client.timezone” is set to true.
> 
> Property description:  
> When true the client timezone will be used to convert to the server/database timezone. It is highly recommended to use true as default to always see the correct/same dates/times in all clients (regardless of their timezone).

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 9, 2009, 1:48pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/9 "2009-06-09T13:48:12Z")

</div>

This fixed the problem.  
Thanks a lot Harjo!  
Diana

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 15, 2009, 9:07am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/10 "2009-06-15T09:07:32Z")

</div>

Hello,

Is it possible that setting servoy.use.client.timezone = true messes up the existing dates in the database?  
(For records previously introduced from a place with time zone GMT+9: the dates now show one day less. For other time zones the dates are displayed correctly, I am confused…)

Diana

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [June 15, 2009, 11:30am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/11 "2009-06-15T11:30:58Z")

</div>

Hi Dianna,

no it doesnt mess up the data in the database. It just returns now a different end result.  
Because it interpers the date now different at the server/client.

for example if you have that property to false:

Client in TimeZone X sends Date X (10:00) → send to server in TimeZone Z → Saves Date X as is (seen as 11:00 at the server)  
Client in TimzeZone Y reads Date X and sees that date in its own time (12:00)

set the property to true:

Client in TimeZone X sends Date X (10:00) → send to server in TimeZone Z → Date saved converted so that it is also seen as 10:00 at the server  
Client in TimzeZone Y reads Date X and sees again that date converted to its own time also at 10:00

So with that property to true, no matter where you are you will see the inserted time (so the toString() of the date is everywhere the same)  
If you want to support multiply timezone’s then you have to store that besided the time column so that you know that 10:00 is really 10 at timezone X.

But now back to the question.

If you have dates inserted without the property. then read with the property it will do conversion so the Client in TimeZone X that sends the date with time: 10:00  
but that time was at the servers timezone 11:00 then with the property suddenly on the client in TimeZone X will see that date as 11:00  
(because the times are from the server on “stable”)

so it seems to be messed up for you yes. Because now the previous times are converted to always see the exact toString() the server sees.

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 15, 2009, 12:32pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/12 "2009-06-15T12:32:18Z")

</div>

Thank you very much for the clearings Johan!  
If i understood correctly,the data seems to be “messed up” for me only for the dates introduced when property was on false. So from now on (property = true) the dates will always be the same: the ones on the server. Please correct me if I am wrong.

Diana

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [June 15, 2009, 1:53pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/13 "2009-06-15T13:53:14Z")

</div>

yes if the property is on true then where ever a date like “2009-15-06 10:30” is inserted from, what ever timezone  
it will always come out exactly the same on what ever time zone you view it again in.

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [June 15, 2009, 2:45pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/14 "2009-06-15T14:45:36Z")

</div>

Thanks Johan!

---

<div class="post-metadata">

**Author:** ![diana.bodnarescu](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@diana.bodnarescu](https://forum.servoy.com/u/diana.bodnarescu)\
**Post date:** [July 8, 2009, 12:57pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/15 "2009-07-08T12:57:48Z")

</div>

> So with that property to true, no matter where you are you will see the inserted time (so the toString() of the date is everywhere the same)

Hi,  
I have the property on TRUE and yet there is an hour difference between what is in the database and what is displayed in the client **for new created records, so records created with property set on TRUE.** I posted the same issue in “Time displayed with different values in web and smart client”, because first I thought of it as a different issue…  
I really need your help on this one,a wrong date is incorrect info displayed to the user and it has bad consequences…  
Many thanks in advance!  
Diana

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 10, 2009, 7:29am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/16 "2009-07-10T07:29:13Z")

</div>

how do you know what is in the database?

So you are saying with that property set to true.  
If you insert a date in timezone X then read it back in in another client in timezone Y that client sees another time?

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [July 15, 2009, 11:36am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/17 "2009-07-15T11:36:41Z")

</div>

> jcompagner:  
> set the property to true:  
> Client in TimeZone X sends Date X (10:00) → send to server in TimeZone Z → Date saved converted so that it is also seen as 10:00 at the server  
> Client in TimzeZone Y reads Date X and sees again that date converted to its own time also at 10:00

When servoy.use.client.timezone = true, the user time zone date and time is saved into the database when using application.getServerTimeStamp() even if the user is in another time zone then the server. Is this correct behaviour?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 15, 2009, 8:45pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/18 "2009-07-15T20:45:52Z")

</div>

which servoy version are you talking about?

in 3.5 the server time will not be converted when going from the server to the client (and when you save it will) so this isnt really correct yes (the client doesnt really ‘see’ the server time)

in 4.1.1+ this is fixed then if you ask the server time and it is 10 oclock it will be “10:00” when arriving in the client  
and when saved it will really be savend as “10:00” (even if the client time is “12:00”

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [July 15, 2009, 9:10pm UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/19 "2009-07-15T21:10:23Z")

</div>

> jcompagner:  
> which servoy version are you talking about?

3.5.7

> in 3.5 the server time will not be converted when going from the server to the client (and when you save it will) so this isnt really correct yes (the client doesnt really ‘see’ the server time)

Ergh… we try to track -method- execution duration time with users on different time zones. The log records contain now wrong start and end times…

> in 4.1.1+ this is fixed then if you ask the server time and it is 10 oclock it will be “10:00” when arriving in the client  
> and when saved it will really be savend as “10:00” (even if the client time is “12:00”

Perfect. Thank you.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 16, 2009, 7:21am UTC](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754/20 "2009-07-16T07:21:23Z")

</div>

you want to track what exactly?  
client side method execution time? why do you need to have a server time for that?  
You want to track when the method did start? or how long it toke?

[Next page](https://forum.servoy.com/t/date-field-and-date-dataprovider-is-displayed-incorrect/10754.md?page=2)
