Answers for "how to check current year in java"

4

java get current year

import java.util.Calendar;

int year = Calendar.getInstance().get(Calendar.YEAR);
Posted by: Guest on November-06-2020
0

java get year from date

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = format.parse(datetime);
SimpleDateFormat df = new SimpleDateFormat("yyyy");
year = df.format(date);
Posted by: Guest on October-08-2020

Code answers related to "how to check current year in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language