| | |
| | | package com.yeshi.fanli.tag;
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Calendar;
|
| | |
|
| | | import javax.servlet.jsp.JspException;
|
| | | import javax.servlet.jsp.tagext.TagSupport;
|
| | |
|
| | | public class DateTag extends TagSupport {
|
| | | |
| | | private static final long serialVersionUID = -9203464472751067726L;
|
| | | |
| | | private String value;
|
| | |
|
| | | @Override
|
| | | public int doStartTag() throws JspException {
|
| | | String vv = "" + value;
|
| | | try {
|
| | | long time = Long.valueOf(vv.trim());
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTimeInMillis(time);
|
| | | SimpleDateFormat dateformat = new SimpleDateFormat(
|
| | | "yyyy-MM-dd HH:mm:ss");
|
| | | String s = dateformat.format(c.getTime());
|
| | | pageContext.getOut().write(s);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return super.doStartTag();
|
| | | }
|
| | |
|
| | | public void setValue(String value) {
|
| | | this.value = value;
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.tag; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | |
| | | import javax.servlet.jsp.JspException; |
| | | import javax.servlet.jsp.tagext.TagSupport; |
| | | |
| | | public class DateTag extends TagSupport { |
| | | |
| | | private static final long serialVersionUID = -9203464472751067726L; |
| | | |
| | | private String value; |
| | | |
| | | @Override |
| | | public int doStartTag() throws JspException { |
| | | String vv = "" + value; |
| | | try { |
| | | long time = Long.valueOf(vv.trim()); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTimeInMillis(time); |
| | | SimpleDateFormat dateformat = new SimpleDateFormat( |
| | | "yyyy-MM-dd HH:mm:ss"); |
| | | String s = dateformat.format(c.getTime()); |
| | | pageContext.getOut().write(s); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return super.doStartTag(); |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |