07hnust

导航

2012年3月7日 #

date String Timestamp 的相互转化

摘要: 用Timestamp来记录日期时间还是很方便的,但有时候显示的时候是不需要小数位后面的毫秒的,这样就需要在转换为String时重新定义格式。 Timestamp转化为String:SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒Timestamp now = new Timestamp(System.currentTimeMillis());//获取系统当前时间String str = df.format(now); String转化为Timestamp:Simple 阅读全文

posted @ 2012-03-07 12:18 07hnust 阅读(331) 评论(0) 推荐(0) 编辑

Hibernate+sqlserver向数据库中添加日期类型

摘要: 从数据库中读取日期值:public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response){ TimeForm timeForm = (TimeForm) form;// TODO Auto-generated method stub String id = timeForm.getTimeid(); Configuration config = new Configuration().configure()... 阅读全文

posted @ 2012-03-07 12:16 07hnust 阅读(934) 评论(0) 推荐(0) 编辑