Java Swing Text Format dataFormatada(Calendar cal)

Here you can find the source of dataFormatada(Calendar cal)

Description

data Formatada

License

Open Source License

Declaration

public static String dataFormatada(Calendar cal) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Calendar;

import javax.swing.text.MaskFormatter;

public class Main {
    public static String dataFormatada(Calendar cal) {

        SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");

        return format1.format(cal.getTime());

    }/*from www .  ja  v  a  2s . co m*/

    private static String format(String pattern, Object value) {
        MaskFormatter mask;
        try {
            mask = new MaskFormatter(pattern);
            mask.setValueContainsLiteralCharacters(false);
            return mask.valueToString(value);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. createFormattedDateField(DateFormat dfFormat, boolean bOverwriteMode)
  2. createFormatter(String s)
  3. createFormatterMask(final String mask)
  4. createIntegerFormatter(int minimum, int maximum)
  5. createMaskFormatter(final String s)
  6. findElementUp(String name, Element start)
  7. findMatchingBracket(Element el, int offset)
  8. findNext(boolean reverse, int pos)
  9. formartCpf(String cpf)