Android Date Format getCurrentDateTime()

Here you can find the source of getCurrentDateTime()

Description

get Current Date Time

Declaration

public static String getCurrentDateTime() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getCurrentDateTime() {
        return getFormatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss");
    }/*w  w w.  j  av a  2 s  . c  om*/

    public static String getFormatDateTime(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}

Related

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