Here you can find the source of invertDate(String sDate)
public static String invertDate(String sDate)
//package com.java2s; public class Main { public static String invertDate(String sDate) { String retVal = sDate;//w ww .j a v a 2 s .c o m if (sDate != null) { if (sDate.length() == 6) { retVal = sDate.substring(4, 6) + sDate.substring(2, 4) + sDate.substring(0, 2); } else { retVal = sDate.substring(4, 8) + sDate.substring(2, 4) + sDate.substring(0, 2); } } return retVal; } }