Java tutorial
import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneId; import java.time.ZoneOffset; public class Main { public static void main(String[] argv) { ZoneId INDIA = ZoneId.of("Asia/Kolkata"); LocalDateTime datetime = LocalDateTime.now(); ZoneOffset offset = ZoneOffset.of("+05:30"); OffsetDateTime date = OffsetDateTime.of(datetime, offset); System.out.println("OffsetDateTime.now() = " + OffsetDateTime.now()); System.out.println("OffsetDateTime.now(TimeZone.INDIA) = " + OffsetDateTime.now(INDIA)); System.out.println("Date and Time: " + datetime); System.out.println("Date and Time with timezone offset: " + date); } }