Java Today today(String pattern)

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

Description

today

License

Apache License

Parameter

Parameter Description
pattern a parameter

Declaration

public static String today(String pattern) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    /**//from   w w  w.  ja  v  a2 s.c  o  m
     * @param pattern
     * @return
     */
    public static String today(String pattern) {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);

        return dateFormat.format(calendar.getTime());
    }
}

Related

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