get Today in yyyy/MM/dd format - Android java.util

Android examples for java.util:Today

Description

get Today in yyyy/MM/dd format

Demo Code


//package com.java2s;
import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    @SuppressLint("SimpleDateFormat")
    public static String getToday() {
        return new SimpleDateFormat("yyyy/MM/dd").format(new Date());
    }/*from w  w w .  j  a v  a 2 s .  c om*/

    @SuppressLint("SimpleDateFormat")
    public static String getToday(String strFormat) {
        return new SimpleDateFormat(strFormat).format(new Date());
    }
}

Related Tutorials