How To Get The Current Date Time of Your Time Zone In Java

This example shows you how to get the current date time of your time zone.

Check this Get List of All TimeZone IDs example for getting your time zone ID.
package com.bytenota; 

import java.text.SimpleDateFormat; 
import java.util.Calendar; 
import java.util.TimeZone; 

public class DateTimeExample {
    public static void main(String[] args) { 
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
        Calendar cal = Calendar.getInstance(); 
        String currentDateTime = dateFormat.format(cal.getTime()); 
        System.out.println(currentDateTime); // 2017-07-25 12:44:13