JR Galia
JR Galia

Reputation: 17269

AppEngine java.util.Date with Timezone in Struts2

Im using Struts2 in Google App Engine.

I have java.util.Date property in an entity.

private Date date = null;

public Date getDate() {
    return date;
}
public void setDate(Date date) {
    this.date = date;
}

I want to display the date with our timezone which is GMT+8. So I have the following in my view:

<s:date name="dateAdded" format="MMM. d, yyyy / hh:mm a" timezone="GMT+08:00" />

But it is not displaying the correct time for GMT+8.

Anybody can explain the behaviour? How to display it in GMT+8?

Upvotes: 1

Views: 508

Answers (1)

Yogendra Singh
Yogendra Singh

Reputation: 34367

I think you need to use the timezone name:

      <s:date name="dateAdded" format="MMM. d, yyyy / hh:mm a" timezone="PST" />

or

      <s:date name="dateAdded" format="MMM. d, yyyy / hh:mm a" 
                                               timezone="America/Los_Angeles" />

Upvotes: 1

Related Questions