Java Date Now currentDateAsString()

Here you can find the source of currentDateAsString()

Description

current Date As String

License

Apache License

Declaration

public static String currentDateAsString() 

Method Source Code


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

import java.text.DateFormat;

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

public class Main {
    public static String currentDateAsString() {
        return toString(Calendar.getInstance());
    }/*from  w ww  .ja  v a  2 s.  c  o m*/

    public static String toString(Calendar c) {
        return getDateFormat().format(c.getTime());
    }

    private static DateFormat getDateFormat() {
        DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
        return formatter;
    }
}

Related

  1. currentDate(String format, Locale locale)
  2. currentDate(String format, String locale)
  3. currentDate2String()
  4. currentDate2String()
  5. currentDate_DDMMYY()
  6. currentDatePath(String basePath)
  7. currentDateStr()
  8. currentDateStr(String format)
  9. currentDateString()