Blame view

src/main/java/daeucna/utils/ConvertUtil.java 815 Bytes
0206c002   함상기   2024-04-15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  package daeucna.utils;

  

  import java.sql.Timestamp;

  import java.text.SimpleDateFormat;

  import java.util.Locale;

  

  public class ConvertUtil {

  

  	/**

  	 *

  	 * Timestamp 형식의 날짜를 입력한 Format  Locale  따라 Formatting 한다.

  	 *

  	 * <pre>

  	 *

  	 * [사용 예제]

  	 *

  	 * formatTimestamp("2004-02-25 15:45:31.156","yyyy년MM월dd일",Locale) ===> 20040225

  	 *

  	 * </pre>

  	 *

  	 * @param timestamp Timestamp 형식의 날짜

  	 * @param format    SimpleDateFormat  적용할 format

  	 * @param locale    국가별 LOCALE

  	 * @return java.lang.String

  	 */

  	public static String formatTimestamp(Timestamp timestamp, String format, Locale locale) {

  

  		SimpleDateFormat formatter = new SimpleDateFormat(format, locale);

  		return formatter.format(timestamp);

  

  	}

  

  }