Format long value to date in yyyy-M-d format - Android java.util

Android examples for java.util:Date Format

Description

Format long value to date in yyyy-M-d format

Demo Code


import java.text.SimpleDateFormat;

public class Main{

    private static String toNYR(long data) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d");
        try {//w ww. j a  v  a  2s .  c o m
            return dateFormat.format(data);
        } catch (Exception e) {
            return "";
        }
    }

}

Related Tutorials