Java Date Now getNowDateStr(String formatStr)

Here you can find the source of getNowDateStr(String formatStr)

Description

get Now Date Str

License

Apache License

Declaration

public static String getNowDateStr(String formatStr) 

Method Source Code

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

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

public class Main {

    public static String getNowDateStr(String formatStr) {
        SimpleDateFormat format = new SimpleDateFormat(formatStr);
        return format.format(getNowDate());
    }/*from www  . j  a  va2  s. c  o m*/

    public static Date getNowDate() {
        Calendar c = Calendar.getInstance();
        return c.getTime();
    }
}

Related

  1. getNowDate()
  2. getNowDate()
  3. getNowDate(String format)
  4. getNowDate(String format)
  5. getNowDateShort()
  6. getNowDateString(String sign)