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 :: java scanner netLine 
Java :: install java debian 8 
Java :: check instance of java 
Java :: dijkstra java 
Java :: convert string to character array 
Java :: valueof vs tostring 
Java :: generate 5 digit random string in java 
Java :: android studio, not loading url in webview 
Java :: Java Scanner nextLine() 
Java :: create stream from array java 
Java :: get time android 
Java :: how to write deserlizer java 
Java :: set remove element java 
Java :: string replace java 
Java :: java terminal colors 
Java :: How to swap two values in Java using a supporting method? 
Java :: default method in java 
Java :: How to count the number of islands (groups of adjacent 1s) in a grid of 1s (land) and 0s (water), in Java? 
Java :: Who made java ? 
Java :: days between two dates android 
Java :: from string to double java 
Java :: how to check if string is double or not in java 
Java :: send whatsapp message java android studio 
Java :: Exception in thread main java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file 
Java :: set java path on linux ubuntu 
Java :: logical operators in java 
Java :: enum with numbers java 
Java :: viewpager2 dependency 
Java :: empty set java 
Java :: java print statement 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =