目前分類:Java 123 (3)

瀏覽方式: 標題列表 簡短摘要

程式代碼:  

        DateFormat dateFormat = 
            new SimpleDateFormat("yyyy-MM-dd");           
        Date birth = dateFormat.parse(args[0]);
        Date current = new Date();

Tako軒 發表在 痞客邦 留言(0) 人氣()

import java.util.Date;

import java.text.SimpleDateFormat;

 

public String getDateTime(){
SimpleDateFormat nowFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
Date date = new Date();
String nowDate = nowFormat.format(date);
//System.out.println(nowDate);
return nowDate;
}


Tako軒 發表在 痞客邦 留言(0) 人氣()

Class

[存取修飾詞] + 宣告類別 + 類別名稱 + { }

ex : public class HelloWorld { ... }

Method

[存取修飾詞] + [static] + 回傳值 + 方法名稱(參數) + { ... }

文章標籤

Tako軒 發表在 痞客邦 留言(0) 人氣()