Android Date Format getBeforeYear()

Here you can find the source of getBeforeYear()

Description

get Before Year

Declaration

public static String getBeforeYear() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getBeforeYear() {
        String currentYear = getFormatCurrentTime("yyyy");
        int beforeYear = Integer.parseInt(currentYear) - 1;
        return "" + beforeYear;
    }/*  www . ja v a  2  s .  c  o m*/

    public static String getFormatCurrentTime(String format) {
        return getFormatDateTime(new Date(), format);
    }

    public static String getFormatDateTime(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}

Related

  1. formatDateAndTime(long millis)
  2. formatTM(Date d)
  3. fromString(String dateStr)
  4. fromString(String dateStr, String dateFormat)
  5. fromString(String dateStr, String dateFormat, Locale locale)
  6. getCurrentDate()
  7. getCurrentDateString(String dateFormat)
  8. getCurrentDateTime()
  9. getCurrentDay()