[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Format a date variable coming from the Database  XML
Forum Index -> Deployment
Author Message
gseijo

Active

Joined: 29/09/2020 14:14:26
Messages: 18
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?

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5258
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
gseijo

Active

Joined: 29/09/2020 14:14:26
Messages: 18
Offline

Thnxx Björn
 
Forum Index -> Deployment
Go to:   
Powered by JForum 2.1.6 © JForum Team