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


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> 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM