Java SQL Date Format formatDate(java.util.Date uDate)

Here you can find the source of formatDate(java.util.Date uDate)

Description

formatDate

Dinh dang ngay kieu java.util.Date thanh String theo mau "dd/MM/yyyy"

License

Apache License

Parameter

Parameter Description
uDate java.util.Date

Return

Chuoi ngay theo dinh dang "dd/MM/yyyy" hoac null

Declaration

public static String formatDate(java.util.Date uDate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

public class Main {
    /**/*from   ww w . j  a  va 2s. c  o m*/
     * <h1>formatDate</h1> Dinh dang ngay kieu java.util.Date thanh String theo
     * mau "dd/MM/yyyy"
     * 
     * @param uDate
     *            java.util.Date
     * @return Chuoi ngay theo dinh dang "dd/MM/yyyy" hoac null
     */
    public static String formatDate(java.util.Date uDate) {
        if (uDate == null) {
            return null;
        } else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
            return dateFormat.format(uDate);
        }
    }

    /**
     * <h1>formatDate</h1> Dinh dang ngay kieu java.sql.Date thanh String theo
     * mau "dd/MM/yyyy"
     * 
     * @param sDate
     *            java.sql.Date
     * @return Chuoi ngay theo dinh dang "dd/MM/yyyy" hoac null
     */
    public static String formatDate(java.sql.Date sDate) {
        if (sDate == null) {
            return null;
        } else {
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
            return dateFormat.format(sDate);
        }
    }
}

Related

  1. dateFormatJson(Date date)
  2. dateFromLong(Long longObject)
  3. formataData(Date data)
  4. formatAsText(ResultSet result_set, PrintWriter out)
  5. formatBytableCols(Object[] obj, String[] tableCols)
  6. formatDate(Object obj)
  7. formatDate(String date)
  8. formatDateTd(Object obj)
  9. formatDateToCustfmt(java.util.Date date, String dateFmt)