Here you can find the source of formatDay(String date)
public static String formatDay(String date)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatDay(String date) { String result = null;//from ww w . j a v a 2s.c o m String[] tmp = date.split("\\-"); String year = tmp[0]; String month = tmp[1]; String day = tmp[2]; if (Integer.parseInt(month) < 10) { month = "0" + month; } if (Integer.parseInt(day) < 10) { day = "0" + day; } result = year + "-" + month + "-" + day; return result; } }