One way to find out when the system is to use a format that is already provided by the Java package. You simply write the appropriate format and then call the command to display it.
But earlier, note first that the command format used to access time.
Below are examples of program code:
import java.text.*;
import java.util.*;
class FormatDate{
public static void main(String args[]){
String pattern="' \n Tahun:'";
pattern +="yyyy GG";
pattern +="'.\n Bulan : '";
pattern +="MMMMMMMMM";
pattern +="'.\n Jam :'";
pattern +="hh";
pattern +="a, zzzz";
pattern +="'.'";
SimpleDateFormat format=new SimpleDateFormat(pattern);
String formattedDate=format.format(new Date());
System.out.println(formattedDate);
}
}
save with filename: FormatDate.java
0 comments:
Post a Comment