I got Codes below, it generates my current time.
public static void main(String[] args) {
long timeInMillis = System.currentTimeMillis();
Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(timeInMillis);
SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss a");
String dateforrow = dateFormat.format(cal1.getTime());
System.out.println(dateforrow );
}
Now How can I add hours to the current time? Like for example my current time 4:30:00 PM , and I want to add 8 hours to it, so maybe the output is 0:30:00 AM. I have no Idea.