Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get current year

import java.util.Calendar;

int year = Calendar.getInstance().get(Calendar.YEAR);
Comment

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);
Comment

java get year

import java.time.ZoneId;
import java.util.Date;

new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().getYear();
Comment

java get year


int year = Calendar.getInstance().get(Calendar.YEAR);

Comment

PREVIOUS NEXT
Code Example
Java :: how to create relative layout in android studio 
Java :: JAVA HashMap get keys by values 
Java :: convert date to offsetdatetime in java 
Java :: bytes to string solidity 
Java :: how to print hello world java 
Java :: java home mac 
Java :: select photo from camera android 
Java :: how to make a copy of an array java 
Java :: java random number between 2 values inclusive 
Java :: changer version java terminal 
Java :: How to count the number of islands (groups of adjacent 1s) in a grid of 1s (land) and 0s (water), in Java? 
Java :: Java how to make a number with digits 
Java :: java % 
Java :: how to check if a string is numeric 
Java :: java gridpane background color 
Java :: arraylist items into string 
Java :: split method in java 
Java :: fibonacci number in java 
Java :: java download image file 
Java :: implement the bubble sort algorithm on the following arraylist 
Java :: integer to string java 
Java :: ternary operator in java for null check 
Java :: copy constructor in java 
Java :: random boolean java 
Java :: string to stream java 
Java :: get minimum of array java 
Java :: android-edittext allow only characters and numbers 
Java :: check if list includes value java 
Java :: difference between two LocalDateTime java 
Java :: Count Occurrences in Seven Integers Using Java Single Dimension Arrays 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =