public Timestamp strToDate(int type){ Timestamp time = null; DateFormat format2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; Calendar cale = Calendar.getInstance(); cale.add(Calendar.DATE, type); String tarday = new SimpleDate
unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒. 在大多数的UNIX系统中UNIX时间戳存储为32位,这样会引发2038年问题. 但是,因为需求是需要int类型的UNIX时间戳. 开始的时候我是这样设计的. /** * 获取当前事件Unxi 时间戳 * @return */ public static int getUnixTimeStamp(){ long rest=System.currentTimeMillis()/1000L; return (i
java获取取得Timestamp类型的当前系统时间java获取取得Timestamp类型的当前系统时间 格式:2010-11-04 16:19:42 方法1: Timestamp d = new Timestamp(System.currentTimeMillis()); 方法2: Date date = new Date(); Timestamp nousedate = new Timestamp(date.getTime()); ------------------------