JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java SE 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 使用中文日期格式將日期物件被印出
evian





發文: 10
積分: 0
於 2018-11-01 06:39 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
class MDate{
  int y,m,d;
  static String[] cnum= {"〇","一","二","三","四","五","六","七","八","九","十"};
  MDate(){}
  MDate(int y,int m,int d){
    this.y=y; this.m=m; this.d=d;
  }
  public String toString() {
    return "";
  }
}
public class Test {

  public static void main(String[] args) {
    // TODO Auto-generated method stub
    MDate md=new MDate(1905,10,23); //1905,10.23
    System.out.println(md); //印出西元一九〇五年十月二十三日
  }

}

請問要怎麼將日期改為中文的格式印出呢?


reply to postreply to post
作者 Re:使用中文日期格式將日期物件被印出 [Re:evian]
roytsang





發文: 619
積分: 1
於 2018-11-01 08:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你已經宣告了array 了,方向正確!
為何不嘗試一下呢?
有了array, 你想想要用for-loop 嗎?
如果用又要如何用呢?
所謂千里之行,始於足下,請先嘗試一下,如有問題請再上來問吧!


reply to postreply to post
作者 Re:使用中文日期格式將日期物件被印出 [Re:roytsang]
evian





發文: 10
積分: 0
於 2018-11-01 12:42 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你好
我有用過for迴圈的方法,但無法打出來
請問可以多給幾個方向嗎?


reply to postreply to post
作者 Re:使用中文日期格式將日期物件被印出 [Re:evian]
roytsang





發文: 619
積分: 1
於 2018-11-01 15:59 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請你把你"for迴圈"的程式放上來, show your work, please!

reply to postreply to post
作者 Re:使用中文日期格式將日期物件被印出 [Re:evian]
ynchang





發文: 151
積分: 0
於 2018-11-02 09:39 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
先去思考看看下列兩個問題, 再去實作看看
1. 要怎麼將數字轉成中文字, 譬如1905轉成一九〇五
2. 程式中已經有year, month, day的資料了, 要怎麼印出西元XXXX年XX月XX日


reply to postreply to post
» JWorld@TW »  Java SE 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8