Java yyyy formatarData(Date data)

Here you can find the source of formatarData(Date data)

Description

formatar Data

License

Open Source License

Declaration

public static String formatarData(Date data) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String FORMATO_DATA_DD_MM_AAAA_BARRA = "dd/MM/yyyy";

    public static String formatarData(Date data, String pattern) {
        String stData = "";

        if ((data != null) && (pattern != null)) {
            DateFormat format = new SimpleDateFormat(pattern);
            stData = format.format(data);
        }//from   w  w w .j  a  va  2s  .c  o m

        return stData;
    }

    public static String formatarData(Date data) {
        return formatar(data, FORMATO_DATA_DD_MM_AAAA_BARRA);
    }

    public static String formatar(Date data, String pattern) {
        String stData = "";

        if ((data != null) && (pattern != null)) {
            DateFormat format = new SimpleDateFormat(pattern);
            stData = format.format(data);
        }

        return stData;
    }
}

Related

  1. format(String oldPattern, String newPattern, String data)
  2. format2(Date data)
  3. format6chars(Date date)
  4. format6chars(Date date, TimeZone tz)
  5. formatAddDate(String src, String pattern, int amount)
  6. formatarData(String pattern, Date data)
  7. formatarDataArquivo(Date data)
  8. formatAsCassandraDate(Date date)
  9. formatAsNumber(Date date)