Android Date Time Get getDatetime()

Here you can find the source of getDatetime()

Description

get Datetime, "yyyy-MM-dd HH:mm:ss"

Declaration

public static String getDatetime() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    public static final String FORMAT_DATETIME = "yyyy-MM-dd HH:mm:ss";

    public static String getDatetime() {
        Calendar calendar = Calendar.getInstance();

        SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATETIME);
        return sdf.format(calendar.getTime());
    }/*from  w w w .j  a v  a2  s. co  m*/
}

Related

  1. getCurDateTime()
  2. getCurDateTime(String pattern)
  3. getCurrentDate(String time)
  4. getCurrentDate(long time)
  5. isNight()
  6. getDateDifference(Date thenDate)
  7. currentTimeLabel()
  8. currentTimeToString(int format, String delimiter)