JAVA : how to add extra time for timestamp -
this question has reply here:
how can increment date 1 day in java? 20 answerssorry im new java, may know how can add together time in here?
simpledateformat timestampformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); string currtimestamp = timestampformat.format(new date()); system.err.println("currtimestamp=="+currtimestamp); // 2014/10/17 14:31:33
you can utilize calender this.
calendar calendar=calendar.getinstance(); // current time system.out.println(calendar.gettime()); calendar.add(calendar.minute,3); // add together 3 minutes current time system.out.println(calendar.gettime());
out put:
fri oct 17 12:17:13 ist 2014 fri oct 17 12:20:13 ist 2014
java
No comments:
Post a Comment