Android Time Get getNowDateTime()

Here you can find the source of getNowDateTime()

Description

get Now Date Time

Return

: String

Declaration

public static String getNowDateTime() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**//  w ww. j a v  a 2s .  co  m
     * @Title : getNowDateTime
     * @return : String
     */
    public static String getNowDateTime() {
        Date date = new Date();
        return formatDate(date);
    }

    /**
     * @Title : formatDate
     * @param : @param d
     * @return : String
     */
    public static String formatDate(Date d) {
        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return s.format(d);
    }

    /**
     * @Title : formatDate
     * @param : @param s
     * @param : @param d
     * @return : String
     */
    public static String formatDate(SimpleDateFormat s, Date d) {
        return s.format(d);
    }
}

Related

  1. getDateTime()
  2. getDateTime(String format)
  3. getDateTimeFromCal(Calendar cal)
  4. getTimeStr(Date date)
  5. getTimeString(String strTime)
  6. getTimeAsInt()
  7. nowAsTime()
  8. getCurrentTimeCalendar()
  9. getCurrentTimeStr()