Date weirdnes

A customer of mine noticed a weird date issue.
The birthdates were one day off (like 29th was 28th) on a list they use.

Turns out that on that list I use a label with the field as a tag.
When I put that same field as normal text_field on that form (no formatting applied) it shows correctly.
Using a label with the field as dataprovider shows the date also correctly.

The column is a DATE type in the (PostgreSQL) database.

Anyone else seeing this?

Servoy Developer
Version R2 2.2.5-build 337
Java version 1.5.0_06-64 (Mac OS X)

Ooookay, this one is even weirder then expected but a bug nevertheless.

When you have a database field (date/datetime) and you use this in a label as a tag then when you show a date that ranges from 1-1-xx50 to 1-2-xx70 (any century before 2000) then it looses a day.

So:
1-1-1950 becomes 31-12-1949
1-1-1655 becomes 31-12-1654
etc.

When using a date from a global field everything works fine.

Servoy Developer
Version R2 2.2.5-build 337
Java version 1.5.0_06-64 (Mac OS X)

Bug filled in bugbase (case: 43438 ) with example solution.

Although not a friday, what can you expect of a ‘13th’…

Just wait till it’s Saterday the 14th.
Then all the bugs in all the bugbases will creep out and cause havoc all around the world.

I guess we will NEED this date bug then to keep us safe ;)

Yes, I have experienced this ‘one day off’ issue as well. In my case it was with insurance policy renewal dates. Fortunately, they were showing one day early and not one day late!

Dean
Windows XP Professional
Sybase

I have this weird feeling that this probably has something to do with timezones. (It’s always those bloody timezones ;-))

What happens if you set the time of the date to midday?

Is there a difference between the timezone of the servoy server machine and the database machine?

Sebastiaan,

Those ‘bloody timezones’ only apply (or don’t apply) for periods of 20 years (and 1 month) in a century ?

Anyway, I did my testing on my powerbook, so Servoy and the DB are on the same machine.
Also my DATE column doesn’t store any timezone info.

Hope this helps.

Did you sort this out? It’s my understanding (= quite possibly wrong) that dates are always stored as milliseconds since midnight 01 January, 1970
UTC.

With the timezone set to Australia/Victoria (= UTC + 10), before 10am today,
application.getTimeStamp() returns 10 while
application.getTimeStamp().getDate() returns 9.
After 10am they both return 10.

I guess this is the expected behaviour, but I wasn’t expecting it and it caused some problems for me converting dates to strings (eg 10072006 ) before I allowed for the difference.

One problem I’ve not sorted out is, even though I have Australia/Victoria as the default timezone (it’s in the Servoy.Properties file), when I reboot Servoy it’s back to GMT on the Prefs>Locale page. I’m not sure if this is a bug, or if a plugin is messing with the settings.

antonio:
Did you sort this out?

I understand this is fixed in the next release.

which bit? the getDate() or the default Timezone prefs not sticking?

No, the original problem that started this thread is fixed in the next release.
I am not sure if your problem is related.