Java SQL Date Convert to_char(Date date, String format)

Here you can find the source of to_char(Date date, String format)

Description

tchar

License

Open Source License

Declaration

public static String to_char(Date date, String format) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String to_char(Date date, String format) {
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(date).trim();
    }/* ww w.  j  av  a  2 s  .  c o  m*/

    public static String to_char(Timestamp tsp, String format) {
        if (tsp == null) {
            return "";
        }
        return to_char(new Date(tsp.getTime()), format);
    }
}

Related

  1. dateToString(java.sql.Date d)
  2. dateToString(java.sql.Date data)
  3. dateToString(java.sql.Date datee)
  4. dateToString(java.util.Date date, String dateFmt)
  5. to2GMTString(final Date tsStart, final Date tsEnd)
  6. to_char(Date date, String format)
  7. toBigDecimal(@Nullable final Date value)
  8. toCalender(final Date aDate)
  9. todaySqlDate()