Rewriting the @mrres1 code in kotlin
val dateFormat = SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
val date = Date()
// Print current time
Log.d("TIME","Current Time: ${dateFormat.format(date)}")
// Use Calendar to add 10 hours
val calendar = Calendar.getInstance().apply {
time = date
add(Calendar.HOUR_OF_DAY, 10)
}
val newDate = calendar.time
// Print new time
Log.d("TIME","Time after 10 hours: ${dateFormat.format(newDate)}")
Output will be
Current Time: 05/14/2014 01:10:00
Time after 10 hours: 05/14/2014 11:10:00