格式化日期-美国时间格式

import org.joda.time.DateTime;

import java.util.Date;

 public void setCreatedDate(Date createdDate) {

  this.createdDate = createdDate;
 }

 public void setCreatedDate(final DateTime createdDate) {

  this.createdDate = null == createdDate ? null : createdDate.toDate();
 }

 public DateTime getLastModifiedDate() {

  return null == lastModifiedDate ? null : new DateTime(lastModifiedDate);
 }

 

 public DateTime getCreatedDate() {

  return null == createdDate ? null : new DateTime(createdDate);
 }

 

public String getCreateDateStr() {
  if (serviceRequest != null && serviceRequest.getCreatedDate() != null) {
   SimpleDateFormat myFormatter = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
   createDateStr = myFormatter.format(serviceRequest.getCreatedDate().toDate()); //把DateTime类型转换为Date类型
  }
  return createDateStr;
 }

 

在feedbackList.jspx页面输入日期:

<td>${feedback.createDateStr}</td> 

posted @ 2012-02-28 17:26  柠檬Cool  阅读(6666)  评论(0编辑  收藏  举报