关于java计算时间的一个问题。。跪求 急求 。。。 java 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Calendar calendar = Calendar.getInstance(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Timestamp timestamp = new Timestamp(2014,7,1,8,30,0,0); System.out.println(df.format(timestamp)); calendar.setTimeInMillis(timestamp.getTime()); calendar.add(Calendar.MINUTE, -1000); timestamp = new Timestamp(calendar.getTimeInMillis()); System.out.println(df.format(timestamp)) 哥 能解释下这句代码吗Timestamp timestamp = new Timestamp(2014,7,1,8,30,0,0);还有 输出结果是:3914-08-01 08:30:003914-07-31 15:50:00为什么能得到这样的结果啊 3914怎么来的。 java.sql.Timestamp转成Java的Calendar,然后就好操作了 Timestamp 这个类型我用的很少,一般都是用java.util.Date 然后把取出来的时间getTime, 再减去1000. 在转成Date就行了 哥 能解释下这句代码吗Timestamp timestamp = new Timestamp(2014,7,1,8,30,0,0);还有 输出结果是:3914-08-01 08:30:003914-07-31 15:50:00为什么能得到这样的结果啊 3914怎么来的。失误, 那句是为了构造你说的2014/8/1 8:30:00,你应该是从数据库查出来的,我没查数据库,至于输出的3914,是我忘了Timestamp 的年份要减去1900,吧2014换成114就好了!这个构造方法已经废弃了! 关于process的问题,求请教 帮忙解释一下运行结果。 阅读《Java核心开发技术从入门到精通》时,遇到的问题:这个语句是什么意思… 关于解析XML的问题,急!!! StringBuffer jtds调用存储过程返回值(大侠速来,急) 基础知识很重要!! 如何让鼠标拖动时响应得更快 eclipse的swing插件 那位大侠帮帮忙 Strust2 action方法return 问一个多线程的问题
Calendar calendar = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp timestamp = new Timestamp(2014,7,1,8,30,0,0);
System.out.println(df.format(timestamp));
calendar.setTimeInMillis(timestamp.getTime());
calendar.add(Calendar.MINUTE, -1000);
timestamp = new Timestamp(calendar.getTimeInMillis());
System.out.println(df.format(timestamp))
还有 输出结果是:
3914-08-01 08:30:00
3914-07-31 15:50:00
为什么能得到这样的结果啊 3914怎么来的。
还有 输出结果是:
3914-08-01 08:30:00
3914-07-31 15:50:00
为什么能得到这样的结果啊 3914怎么来的。
失误, 那句是为了构造你说的2014/8/1 8:30:00,你应该是从数据库查出来的,我没查数据库,至于输出的3914,是我忘了Timestamp 的年份要减去1900,吧2014换成114就好了!这个构造方法已经废弃了!