Java SQL Date getCurrentYear()

Here you can find the source of getCurrentYear()

Description

This method should return the current year

License

Open Source License

Return

string

Declaration

public static String getCurrentYear() 

Method Source Code

//package com.java2s;
/*//from   ww w.jav  a2s . co m
 * @(#)ConversionUtil.java
 *
 * Copyright by ObjectFrontier, Inc.,
 * 12225 Broadleaf Lane, Alpharetta, GA 30005, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of ObjectFrontier, Inc. You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of
 * the license agreement you entered into with ObjectFrontier.
 */

public class Main {
    /**
     * This method should return the current year 
     *  
     * @return string
     */
    public static String getCurrentYear() {

        java.sql.Date date = new java.sql.Date(System.currentTimeMillis());

        java.text.SimpleDateFormat out = new java.text.SimpleDateFormat("yyyymmdd");

        return out.format(date).substring(0, 4);
    }
}

Related

  1. convert(Object o)
  2. convertTo(Class clazz, Object obj)
  3. convertTo(final Class> clazz, Object obj)
  4. getClasses()
  5. getCurrDay()
  6. getDayOfPerMonth(String theDataStr)
  7. getDiffDays(String begin_dt, String end_dt)
  8. getEndWeekDayOfMonth(String year, String month)
  9. getFileName()