태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

import java.text.SimpleDateFormat;

.
.
.


Format formatter;
   
    // The year
    formatter = new SimpleDateFormat("yy");    // 02
    formatter = new SimpleDateFormat("yyyy");  // 2002
   
    // The month
    formatter = new SimpleDateFormat("M");     // 1
    formatter = new SimpleDateFormat("MM");    // 01
    formatter = new SimpleDateFormat("MMM");   // Jan
    formatter = new SimpleDateFormat("MMMM");  // January
   
    // The day
    formatter = new SimpleDateFormat("d");     // 9
    formatter = new SimpleDateFormat("dd");    // 09
   
    // The day in week
    formatter = new SimpleDateFormat("E");     // Wed
    formatter = new SimpleDateFormat("EEEE");  // Wednesday
   
    // Get today's date
    Date date = new Date();
   
    // Some examples
    formatter = new SimpleDateFormat("MM/dd/yy");
    String s = formatter.format(date);
    // 01/09/02
   
    formatter = new SimpleDateFormat("dd-MMM-yy");
    s = formatter.format(date);
    // 29-Jan-02
   
    // Examples with date and time; see also
    // e316 Formatting the Time Using a Custom Format
    formatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
    s = formatter.format(date);
    // 2002.01.29.08.36.33
   
    formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
    s = formatter.format(date);
    // Tue, 09 Jan 2002 22:14:02 -0500

    // The hour (1-12)
    formatter = new SimpleDateFormat("h");     // 8
    formatter = new SimpleDateFormat("hh");    // 08
   
    // The hour (0-23)
    formatter = new SimpleDateFormat("H");     // 8
    formatter = new SimpleDateFormat("HH");    // 08
   
    // The minutes
    formatter = new SimpleDateFormat("m");     // 7
    formatter = new SimpleDateFormat("mm");    // 07
   
    // The seconds
    formatter = new SimpleDateFormat("s");     // 3
    formatter = new SimpleDateFormat("ss");    // 03
   
    // The am/pm marker
    formatter = new SimpleDateFormat("a");     // AM
   
    // The time zone
    formatter = new SimpleDateFormat("z");     // PST
    formatter = new SimpleDateFormat("zzzz");  // Pacific Standard Time
    formatter = new SimpleDateFormat("Z");     // -0800
   
    // Get today's date
    Date date = new Date();
   
    // Some examples
    formatter = new SimpleDateFormat("hh:mm:ss a");
    String s = formatter.format(date);
    // 01:12:53 AM
   
    formatter = new SimpleDateFormat("HH.mm.ss");
    s = formatter.format(date);
    // 14.36.33



출처: http://www.exampledepot.com/egs/java.text/pkg.html#Times
top

Trackback Address :: http://www.ssial.com/trackback/141 관련글 쓰기

  1. Chanel Outlet 2011/09/17 21:24 댓글주소 | 수정/삭제 | 댓글

    Time is what you make of it.

  2. Burberry Bags 2011/10/13 16:52 댓글주소 | 수정/삭제 | 댓글

    당신이 여기있어 이러한 관심과 좋은 정보를 제공합니다. 나는 그것은 다른 사람에서 더 많은 관심을 끌 것입니다 확신 해요. 내가 찾은 다행이 주셔서 감사합니다.

  3. Coach Outlet Online 2011/11/15 12:39 댓글주소 | 수정/삭제 | 댓글

    I'm happy I found this blog ! It's very good and thank you for sharing it !

  4. Jordy Nelson Jersey 2011/12/07 17:17 댓글주소 | 수정/삭제 | 댓글

    This is a very good article, I think there will be many people like it, of course, I was one of the people. I think this article increase my knowledge. it is nice to know this. Thanks for the time and effort. It is well appreciated. More to come.Good share,you article very great, very usefull for us…thank you

Write a comment


◀ PREV : [1] : ... [94] : [95] : [96] : [97] : [98] : [99] : [100] : [101] : [102] : ... [206] : NEXT ▶