Java Today getTodayFormatted(String pattern)

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

Description

Returns the date formatted in given pattern

License

Open Source License

Parameter

Parameter Description
pattern the pattern (see SimpleDateFormat)

Return

the formatted date in a String

Declaration

public static String getTodayFormatted(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 {
    /**/*w  w  w  .  java 2 s.c  o m*/
     * Returns the date formatted in given pattern
     * @param pattern the pattern (see SimpleDateFormat)
     * @return the formatted date in a String
     */
    public static String getTodayFormatted(String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(new Date());
    }
}

Related

  1. getTodayEnd()
  2. getToDayEndTime()
  3. getTodayFolder()
  4. getTodayFormat(String format)
  5. getTodayFormatString(String pattern)
  6. getTodayHHmmss(String HHmmss)
  7. getTodayInFormat(String format)
  8. getTodayIntevalDays(String date)
  9. getTodayLast()