Java Date Now getCurrentDateString(String dateFormat)

Here you can find the source of getCurrentDateString(String dateFormat)

Description

get Current Date String

License

Open Source License

Declaration

public static String getCurrentDateString(String dateFormat) 

Method Source Code

//package com.java2s;

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

import java.util.TimeZone;

public class Main {

    public static String getCurrentDateString(String dateFormat) {
        Calendar cal = Calendar.getInstance(TimeZone.getDefault());
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        sdf.setTimeZone(TimeZone.getDefault());

        return sdf.format(cal.getTime());
    }//from  ww  w  .j  a  v  a2 s . com
}

Related

  1. getCurrentDateStr()
  2. getCurrentDateStr(String pattern)
  3. getCurrentDateString()
  4. getCurrentDateString()
  5. getCurrentDateString()
  6. getCurrentDateString(String format)
  7. getCurrentDateTime()
  8. getCurrentDateTime()
  9. getCurrentDateTime()