Here you can find the source of getDateFromISODateString(String isoDate)
public static Date getDateFromISODateString(String isoDate)
//package com.java2s; /*// ww w . j a v a 2 s .co m * @(#)ConversionUtil.java * * Copyright by ObjectFrontier, Inc., * 12225 Broadleaf Lane, Alpharetta, GA 30005, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of ObjectFrontier, Inc. You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of * the license agreement you entered into with ObjectFrontier. */ import java.sql.Date; public class Main { public static Date getDateFromISODateString(String isoDate) { String year = getCurrentYear(); return getDateFromRTGSDateString(year + isoDate); } /** * This method should return the current year * * @return string */ public static String getCurrentYear() { java.sql.Date date = new java.sql.Date(System.currentTimeMillis()); java.text.SimpleDateFormat out = new java.text.SimpleDateFormat("yyyymmdd"); return out.format(date).substring(0, 4); } public static Date getDateFromRTGSDateString(String iobDate) { Date date = null; try { int year = Integer.parseInt(iobDate.substring(0, 4)); int month = Integer.parseInt(iobDate.substring(4, 6)); int day = Integer.parseInt(iobDate.substring(6, 8)); date = new Date(year - 1900, month - 1, day); } catch (Exception e) { throw new RuntimeException(e); } return date; } }