Android Date Current Get getCurrentDate()

Here you can find the source of getCurrentDate()

Description

get Current Date

Declaration

public static String getCurrentDate() 

Method Source Code

//package com.java2s;
import java.util.Date;

public class Main {
    public static String getCurrentDate() {
        String dateStr = null;//from   ww  w . j  a  va 2  s .  c o m
        Date date = new Date();
        date.getTime();
        int year = date.getYear() + 1900;
        int month = date.getMonth() + 1;
        int dt = date.getDate();
        dateStr = year + "-" + ((month < 10) ? "0" + month : month) + "-"
                + ((dt < 10) ? "0" + dt : dt);
        return dateStr;
    }
}

Related

  1. getCurrentDate()
  2. getCurrentDate()
  3. getCurrentDateStamp()
  4. getCurrentDate()
  5. getCurrentDateline()
  6. getCurrentDate()
  7. getCurrentDate()
  8. getCurrentDateJSONString()