Here you can find the source of intToDateString(int i)
static String intToDateString(int i)
//package com.java2s; //License from project: Open Source License public class Main { static String intToDateString(int i) { String s = Integer.toString(i); if (i <= 9999) { return s; }/*from w ww. java 2 s . c o m*/ if (s.length() < 8) return s.substring(0, 4); // return yyyy-mm-dd return s.substring(0, 4) + "-" + s.substring(4, 2) + "-" + s.substring(6, 2); } }