Here you can find the source of toDateOracle(Date d, String format, String hqlFormat)
public static String toDateOracle(Date d, String format, String hqlFormat)
//package com.java2s; import java.util.Date; public class Main { public static String toDateOracle(Date d, String format, String hqlFormat) { StringBuffer bf = new StringBuffer(); bf.append("to_date('"); bf.append(dateFormat(d, format)); bf.append("','"); bf.append(hqlFormat);//from w w w. j av a2s .c o m bf.append("')"); return bf.toString(); } public static String dateFormat(Date d, String formatStr) { return new java.text.SimpleDateFormat(formatStr).format(d); } }