Java Date Now getCurrentDateInyyyyMMddFormat()

Here you can find the source of getCurrentDateInyyyyMMddFormat()

Description

get Current Date Inyyyy M Mdd Format

License

Apache License

Declaration

public static String getCurrentDateInyyyyMMddFormat() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {
    private static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd";

    public static String getCurrentDateInyyyyMMddFormat() {
        Date date = new Date();
        return convertDateToString(date, DATE_PATTERN_YYYYMMDD);
    }/*from   ww  w  . ja v  a  2  s  .c  om*/

    public static String convertDateToString(Date date, String patternString) {
        return convertDateToString(date, patternString, Locale.getDefault());
    }

    public static String convertDateToString(Date date, String patternString, Locale locale) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(patternString, locale);
        return simpleDateFormat.format(date);
    }
}

Related

  1. getCurrentDateFormat()
  2. getCurrentDateFormated()
  3. getCurrentDateInMillis()
  4. getCurrentDateInSqlFormat()
  5. getCurrentDateINYYYY_MM_DD()
  6. getCurrentDateINYYYYMMDDHHMMSSwithColons()
  7. getCurrentDateMMDDYYYY()
  8. getCurrentDateSlashStr()
  9. getCurrentDateStr()