newbie
newbie

Reputation: 24635

How to convert Integer to Date in JSP page and then format that Date?

I get following varaiable, but I cannot format Integer, so is there any way to convert Integer to Date in JSP page?

<fmt:formatDate value="${c.dateInIntegerValue}" pattern="dd.MM.yyyy hh:mm"/>

Upvotes: 0

Views: 3854

Answers (2)

djna
djna

Reputation: 55897

You don't say what class "c" is, but if you have control of it I would add an accessor

c.dateAsDate()

and put the logic for the conversion into the java class. You can put bits of Java for the conversion into your JSP but the danger of doing that is that you end up with lots of little bits of non-reusable Java scattered across your JSPs

Upvotes: 2

Erich Kitzmueller
Erich Kitzmueller

Reputation: 36977

How about

<fmt:formatDate value="${new Date(c.dateInIntegerValue)}" pattern="dd.MM.yyyy hh:mm"/>

Upvotes: 2

Related Questions