Java examples for java.time:Month
Get the Month for specify timestamp.
//package com.java2s; import java.time.*; public class Main { /**/*from w w w.j a v a 2 s .c o m*/ * Get the Month for specify timestamp. * * @param timestamp * A timestamp need to calculate. * @return */ public static int getMonthOfMills(long timestamp) { Instant instant = Instant.ofEpochMilli(timestamp); ZonedDateTime dateTime = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault()); return dateTime.getMonthValue(); } }