Here you can find the source of formatToSqlDate(final Date date)
public static String formatToSqlDate(final Date date)
//package com.java2s; /**/*from w w w .j a v a2 s .c o m*/ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatToSqlDate(final Date date) { final DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); final String formattedSqlDate = df.format(date); return formattedSqlDate; } }