Here you can find the source of getFormattedHour(ZonedDateTime dateTime)
public static String getFormattedHour(ZonedDateTime dateTime)
//package com.java2s; //License from project: Open Source License import java.time.ZonedDateTime; public class Main { public static String getFormattedHour(ZonedDateTime dateTime) { if (dateTime.getHour() < 10) { return "0" + dateTime.getHour(); }// w w w. j a va 2 s . c o m return String.valueOf(dateTime.getHour()); } }