Java Timestamp Convert To convertToString(Timestamp dateData, String pattern, Locale locale)

Here you can find the source of convertToString(Timestamp dateData, String pattern, Locale locale)

Description

convert To String

License

Open Source License

Declaration

public static String convertToString(Timestamp dateData, String pattern, Locale locale) 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Locale;

public class Main {

    public static String convertToString(Timestamp dateData) {
        return convertToString(dateData, "yyyy/MM/dd");
    }/*from  w w  w . j  a v a2 s .co m*/

    public static String convertToString(Timestamp dateData, String pattern) {
        return convertToString(dateData, pattern, Locale.KOREA);
    }

    public static String convertToString(Timestamp dateData, String pattern, Locale locale) {

        if (dateData == null) {
            return null;
        }

        SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);

        return formatter.format(dateData);
    }
}

Related

  1. convertTimestampToStringWithoutTime(final Timestamp ts)
  2. convertToDate(Timestamp aTimeStamp)
  3. convertToDate(Timestamp timestamp)
  4. convertToEpochMillis(java.sql.Timestamp ts)
  5. convertToISO8601String(java.sql.Timestamp ts)
  6. timestamp(Timestamp timestamp)
  7. Timestamp2Arch(Timestamp ts)
  8. timestamp2Calendar(Timestamp ts)
  9. timestamp2Date(java.sql.Timestamp t)