Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to get year from a date in Java?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 341
    Comment on it

    To get only year from a date you can use the below code. You can pass any date that you wan to change, I'm getting year from the date in the below example:


    	 * Get year from Date
    	 * @param createDate
    	 * @return
    	public static String getYear(Date createDate)
    		SimpleDateFormat simple = new SimpleDateFormat();
    		return simple.format(createDate);

    Hope this will help you :)

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: