get Now Date in yyyy-MM-dd format - Android java.util

Android examples for java.util:Date Format

Description

get Now Date in yyyy-MM-dd format

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getNowDate() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Date curDate = new Date();
        return formatter.format(curDate);
    }//from w w  w .ja  va2s.  c  om
}

Related Tutorials