Here you can find the source of getISODate()
public static String getISODate()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { private static SimpleDateFormat stdFormatter = new SimpleDateFormat("yyyyMMddHHmmssSSS"); private static SimpleDateFormat isoFormatter = new SimpleDateFormat("yyyy-MM-dd"); /**/*from w w w . j a v a 2 s .c o m*/ * Get todays date and format into an ISO date string and return * * @return dateStr Todays date string in ISO format */ public static String getISODate() { return isoFormatter.format(getToday()); } /** * Format the given Date dt into an ISO date string and return * * @param dt * The given date * * @return dateStr Todays date string in ISO format */ public static String getISODate(Date dt) { return isoFormatter.format(dt); } /** * Format a Date into a string with the format of "yyyyMMddHHmmssSSS". * * @param val * The Date to format * * @return dstr The formatted date string */ public static String format(Date val) { if (val == null) return null; return stdFormatter.format(val); } /** * Format a Date into a string with the format of the format argument. * * @param format * The SimpleDateFormat string * @param val * The Date to format * * @return dstr The formatted date string */ public static String format(String format, Date val) { if (val == null) return null; SimpleDateFormat formatter = new SimpleDateFormat(format); formatter.setLenient(false); return formatter.format(val); } public static String format(String format, Date val, Locale locale) { if (val == null) return null; SimpleDateFormat formatter = new SimpleDateFormat(format, locale); formatter.setLenient(false); return formatter.format(val); } /** * Format a Date into a string with the format of the format argument for * the given timezone. * * @param format * The SimpleDateFormat string * @param val * The Date to format * @param timezone * The timezone * * @return dstr The formatted date string */ public static String format(String format, Date val, String timezone) { if (val == null) return null; TimeZone tz = null; if (timezone == null || timezone.length() == 0) { tz = TimeZone.getDefault(); } else { tz = TimeZone.getTimeZone(timezone); } return format(format, val, tz); } /** * This private format method is called by the public format method that * accepts a timezone. * * @param format * The SimpleDateFormat string * @param val * The Date to format * @param timezone * The timezone * * @return dstr The formatted date string */ private static String format(String format, Date val, TimeZone timezone) { if (val == null) return null; SimpleDateFormat formatter = new SimpleDateFormat(format); formatter.setTimeZone(timezone); formatter.setLenient(false); return formatter.format(val); } /** * Get todays date * * @return date Todays Date */ public static Date getToday() { return new Date(); } }