TimestampAdapter.java 445 B

1234567891011121314151617181920212223
  1. package com.jtgh.yjpt.webService;
  2. import java.sql.Timestamp;
  3. import java.util.Date;
  4. import javax.xml.bind.annotation.adapters.XmlAdapter;
  5. /**
  6. * 时间转换判断类
  7. *
  8. * @author 袁晓冬
  9. *
  10. */
  11. public class TimestampAdapter extends XmlAdapter<Date, Timestamp> {
  12. public Date marshal(Timestamp t) {
  13. return new Date(t.getTime());
  14. }
  15. public Timestamp unmarshal(Date d) {
  16. return new Timestamp(d.getTime());
  17. }
  18. }