Android Date Format getCurrentDateString(String dateFormat)

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

Description

get Current Date String

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());
    }/*w w  w .  j  a  v a  2  s . c  om*/
}

Related

  1. fromString(String dateStr)
  2. fromString(String dateStr, String dateFormat)
  3. fromString(String dateStr, String dateFormat, Locale locale)
  4. getBeforeYear()
  5. getCurrentDate()
  6. getCurrentDateTime()
  7. getCurrentDay()
  8. getCurrentDayOfWeek()
  9. getCurrentFormatedDate()