Java String to Date toDateOracle(Date d, String format, String hqlFormat)

Here you can find the source of toDateOracle(Date d, String format, String hqlFormat)

Description

to Date Oracle

License

Open Source License

Declaration

public static String toDateOracle(Date d, String format, String hqlFormat) 

Method Source Code


//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);
    }
}

Related

  1. toDateByFormat(String dateString, String formatStr)
  2. toDateByPattern(String dateTime)
  3. toDateFormat(Integer grain, TimeZone timeZone, String dateFormatArg)
  4. toDateFormat(String date)
  5. toDateFormat(String dateFormat, TimeZone tz, Locale locale)
  6. toDates(DateFormat format, String[] values)
  7. toDateString(Calendar cal)
  8. toDateString(Date date)
  9. toDateString(Date date)