Author |
Message |
06/04/2021 13:01:02
|
gseijo
Active
Joined: 29/09/2020 14:14:26
Messages: 21
Offline
|
Hello Björn,
following problem:
I read a numeric variable with date from the database:
endDatum: 190125
that would be:
short = 25.01.19
long = 25.01.2019
if I include the variable in the jsp I always get 190125.
I've tried everything, format, formatrule, formatmask,
no success.
Where is the mistake?
|
|
|
06/04/2021 13:11:51
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5555
Offline
|
Hi,
you need to convert. There are two possibilities:
1. "good old" java.util.Date - use a Calendar function to convert. Pay attention to timezone issues! (!!!)
2. >= Java 1.7 (or 1.8??). Convert to Java's LocalDate. In the layout definition use TIMEZONE="LOCAL"! (!!!)
I believe 2. is the simpler variant for you, because you do not have to pay attention to timezone issues on server side. LocalDate has nice function to get created from y,m,d-information.
(and for accurate people: yes, there is a 3. posibility: you may use long, the long being the timestamp value behind a java.util.Date...)
Regards, Björn
PS: In the developer's Guide there is an own chapter on Date-management - because this is something that typically is not correctly managed in projects...
|
Björn Müller, CaptainCasa GmbH |
|
|
09/04/2021 11:12:31
|
gseijo
Active
Joined: 29/09/2020 14:14:26
Messages: 21
Offline
|
Thnxx Björn
|
|
|
|