Java Data Type How to - Get current time in Europe/Berlin


We would like to know how to get current time in Europe/Berlin.


import java.time.Clock;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
/*w ww  .  ja va 2  s .  co  m*/
public class Main {

  public static void main(String[] args) {

  public static String getCurrentTimeStamp() {
    Clock clock = Clock.system(ZoneId.of("Europe/Berlin"));
    ZonedDateTime now =;
    return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(now);

The code above generates the following result.