admin
2024-01-23 81da61b828e29b7745e1382dfbbaeb685dc083ef
fanli/src/main/java/com/yeshi/fanli/tag/DateTag.java
@@ -1,35 +1,35 @@
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;
   }
}