Java Today today(String strFormat)

Here you can find the source of today(String strFormat)

Description

today

License

Open Source License

Declaration

public static String today(String strFormat) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

    public static String today(String strFormat) {
        return toString(new Date(), strFormat);
    }//from w w  w. j  a v a 2  s  . co m

    public static String toString(Date date, String format) {
        return getSimpleDateFormat(format).format(date);
    }

    private static SimpleDateFormat getSimpleDateFormat(String strFormat) {
        if (strFormat != null && !"".equals(strFormat.trim())) {
            return new SimpleDateFormat(strFormat);
        } else {
            return new SimpleDateFormat();
        }
    }
}

Related

  1. today()
  2. today()
  3. toDay(final String dateString)
  4. today(String format)
  5. today(String pattern)
  6. todayAsSimpleIsoDate(Date date)
  7. todayAsXSDDateString()
  8. todayAtDayEnd()
  9. todayDate()