Here you can find the source of formatIsoDate(Date date)
Parameter | Description |
---|---|
date | the date to convert |
public static String formatIsoDate(Date date)
//package com.java2s; /*//w ww.j av a 2s . c o m * RapidContext <http://www.rapidcontext.com/> * Copyright (c) 2007-2009 Per Cederberg & Dynabyte AB. * All rights reserved. * * This program is free software: you can redistribute it and/or * modify it under the terms of the BSD license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the RapidContext LICENSE for more details. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * The ISO date format. */ private static final SimpleDateFormat ISO_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); /** * Formats a date to an ISO date representation. Note that the * time component of the date value will be ignored. * * @param date the date to convert * * @return the ISO date string */ public static String formatIsoDate(Date date) { if (date == null) { return null; } else { return ISO_DATE_FORMAT.format(date); } } }