Subject | Re: [Firebird-Java] Date shifting |
---|---|
Author | Mark Rotteveel |
Post date | 2018-10-26T06:42:43Z |
On 2018-10-26 00:31, shalamyansky@... [Firebird-Java] wrote:
its definition is based on java.util.Date, and it requires a form of
time zone manipulation to obtain values.
Could you provide a more complete reproduction of the problem, so I can
narrow down the problem, because right now I can think of several
scenarios that might cause this (and some of them could be bugs in
Jaybird).
I'd like to know:
- The dialect of the database
- The connection properties used
- Example code how you retrieve the value and determine that its value
is shifted (preferably in the form of a MCVE).
- The default JVM timezone (result of TimeZone.getDefault() and/or
ZoneId.systemDefault()
Also consider using java.time types (java.time.LocalDate in this case)
instead.
Mark
> Server:Excluding any time zone behavior is impossible with java.sql.Date, as
> Windows Server 2012 64
> Firebird 3.0
> Moscow Time Zone (+0300)
> Fields type DATE
>
> Client:
> Java Jdk (Jre) 8.0
> Spring JPA
> Jaybird-jdk18 3.0.4
> Moscow Time Zone (+0300)
> Objects type Date
>
> Problem:
>
> All the Java.Date variables values are shifted to previos day of real
> Firebird.DATE fields values.
>
> I suppose Jaybird or somebody else accepts DATE as TIMESTAMP,
> '2018-10-25' as '2018-10-25 00:00:00', treats its as '2018-10-25
> 00:00:00 +0300', transforms its into '2018-10-24 21:00:00 +0300', and
> returns as Date '2018-10-24'. Maybe another logic of time zone
> calculating. I'd like work with pure dates without zones, hours and
> date shifting.
>
> My question:
>
> How to fix this matter in one place, preferably somewhere in the
> configuration?
its definition is based on java.util.Date, and it requires a form of
time zone manipulation to obtain values.
Could you provide a more complete reproduction of the problem, so I can
narrow down the problem, because right now I can think of several
scenarios that might cause this (and some of them could be bugs in
Jaybird).
I'd like to know:
- The dialect of the database
- The connection properties used
- Example code how you retrieve the value and determine that its value
is shifted (preferably in the form of a MCVE).
- The default JVM timezone (result of TimeZone.getDefault() and/or
ZoneId.systemDefault()
Also consider using java.time types (java.time.LocalDate in this case)
instead.
Mark