Java Date Now getCurrentDay(String pattern)

Here you can find the source of getCurrentDay(String pattern)

Description

get Current Day

License

Open Source License

Declaration

public static String getCurrentDay(String pattern) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String getCurrentDay(String pattern) {
        SimpleDateFormat simpleFormate = new SimpleDateFormat(pattern);
        return simpleFormate.format(new Date());
    }//from  www  .j a  v a  2  s . co  m

    public static String format(java.util.Date date, String format) {
        String result = "";
        try {
            if (date != null) {
                java.text.DateFormat df = new java.text.SimpleDateFormat(format);
                result = df.format(date);
            }
        } catch (Exception e) {
        }
        return result;
    }

    public static String format(java.util.Date date) {
        return format(date, "yyyy/MM/dd");
    }
}

Related

  1. getCurrentDay()
  2. getCurrentDay()
  3. getCurrentDay()
  4. getCurrentDay()
  5. getCurrentDay(int model)
  6. getCurrentDayBegin()
  7. getCurrentDayInyyyyMMdd()
  8. getCurrentFormattedTime()
  9. getCurrentGMTTime()