get Month from java.sql.Date - Java java.time

Java examples for java.time:Month

Description

get Month from java.sql.Date

Demo Code


//package com.java2s;

import java.sql.Date;

import java.time.LocalDate;

import java.time.Month;

public class Main {
    public static Month getMonth(Date date) {
        LocalDate localDate = date.toLocalDate();

        return localDate.getMonth();
    }/*from w  ww .j a  v a 2s. com*/
}

Related Tutorials