Java Date Format dateformate(String reg, Date newdate)

Here you can find the source of dateformate(String reg, Date newdate)

Description

dateformate

License

Open Source License

Declaration

public static String dateformate(String reg, Date newdate) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    static String REG = "yyyy-MM-dd";
    static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(REG);

    public static String dateformate(String reg, Date newdate) {
        if (!reg.equals(REG)) {
            REG = reg;//from www  . j  ava  2s. c o  m
            simpleDateFormat = new SimpleDateFormat(REG);
        }
        return simpleDateFormat.format(newdate);

    }
}

Related

  1. dateformat(String text, String format)
  2. dateFormat3(Date date)
  3. dateFormat4yyyyMMdd()
  4. dateFormatCheck(String source)
  5. dateFormatCheck(String source, String format)
  6. dateFormater(String dataStr, String dataFormat)
  7. dateFormatString(Date date)
  8. dateFormatted(Date date)
  9. dateFormatter(String dateFormat)