Java Date Now getCurrentDateStr()

Here you can find the source of getCurrentDateStr()

Description

get Current Date Str

License

Apache License

Declaration

public static String getCurrentDateStr() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

    public static String getCurrentDateStr() {
        return formatDate(new Date());
    }/* w w w  .j  a  v  a2 s  .  c om*/

    public static String getCurrentDateStr(String pattern) {
        return formatDate(new Date(), pattern);
    }

    public static String formatDate(Date date, String pattern) {
        SimpleDateFormat df = new SimpleDateFormat(pattern);
        return df.format(date);
    }

    public static String formatDate(Date date) {
        return formatDate(date, "yyyy-MM-dd");
    }
}

Related

  1. getCurrentDateINYYYYMMDDHHMMSSwithColons()
  2. getCurrentDateMMDDYYYY()
  3. getCurrentDateSlashStr()
  4. getCurrentDateStr()
  5. getCurrentDateStr()
  6. getCurrentDateStr()
  7. getCurrentDateStr(String pattern)
  8. getCurrentDateString()
  9. getCurrentDateString()