Java SQL Date to String toStringTH(Date date, String dateFormat)

Here you can find the source of toStringTH(Date date, String dateFormat)

Description

to String TH

License

Open Source License

Declaration

public static String toStringTH(Date date, String dateFormat) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String toStringTH(Date date) {
        return toStringTH(date, "dd/MM/yyyy");
    }/*from www  . j av  a 2  s .  co  m*/

    public static String toStringTH(Date date, String dateFormat) {
        SimpleDateFormat formatter = new SimpleDateFormat(dateFormat, new java.util.Locale("th", "TH"));
        return formatter.format(date);
    }

    public static String toStringTH(java.sql.Date date) {
        return toStringTH(date, "dd/MM/yyyy");
    }

    public static String toStringTH(java.sql.Date date, String dateFormat) {
        SimpleDateFormat formatter = new SimpleDateFormat(dateFormat, new java.util.Locale("th", "TH"));
        return formatter.format(date);
    }
}

Related

  1. toString(Date date, String format)
  2. toString(Date obj)
  3. toString(java.sql.Date sqlDate, String format)
  4. toString(Object date)
  5. toString(Object object)
  6. toStringValue(Date date)