java date add hours
LocalDateTime dateTime=LocalDateTime.now();//or whatever
dateTime.addHours(2);
java date add hours
LocalDateTime dateTime=LocalDateTime.now();//or whatever
dateTime.addHours(2);
add second to date java
/* w w w . j a va 2s . c om*/
import java.util.Calendar;
import java.util.Date;
public class Main {
public static void main(String[] args) {
System.out.println(addSeconds(new Date(), 100));
}
public static Date addSeconds(Date date, Integer seconds) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.SECOND, seconds);
return cal.getTime();
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us