Android Int to Date Convert withZero(int aDay)

Here you can find the source of withZero(int aDay)

Description

with Zero

License

Apache License

Declaration

public static String withZero(int aDay) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String withZero(int aDay) {
        String pattern = "%d";
        if (aDay < 10)
            pattern = "0%d";

        return String.format(pattern, aDay);
    }/*w w  w.j a  v  a2s  . c  o  m*/

    public static String format(String aFormat, long aDate) {
        SimpleDateFormat format = new SimpleDateFormat(aFormat);
        return format.format(new Date(aDate));
    }
}