kotlin
val oneHourLater = now() + 1.hours
kotlin
val nowString = now().format("yyyy-MM-dd HH:mm:ss")
val parsedTime = nowString.toDateTime("yyyy-MM-dd HH:mm:ss")
kotlin
val currentTime = now()
val newYorkTime = currentTime.toOffsetDateTime(Timezone("America/New_York"))
import com.soywiz.klock.DateTime;
import com.soywiz.klock.Timezone;
public class KlockExample {
public static void main(String[] args) {
DateTime currentTime = DateTime.now();
DateTime oneHourLater = currentTime.plus(1.0, DateTimeUnit.HOUR);
System.out.println("Current Time: " + currentTime.toString());
System.out.println("One Hour Later: " + oneHourLater.toString());
DateTime parsedTime = DateTime.parse("2022-01-01 10:30:00", "yyyy-MM-dd HH:mm:ss");
System.out.println("Parsed Time: " + parsedTime.toString());
DateTime newYorkTime = currentTime.toOffsetDateTime(Timezone.Companion.create("America/New_York"));
System.out.println("New York Time: " + newYorkTime.toString());
}
}