Advertisement
rafibatam

Date and Time JAVA

Jun 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. import java.text.SimpleDateFormat;
  2. import java.util.Date;
  3.  
  4. public class DateandTime {
  5.     public static void main(String[] args) {
  6.         Date waktuSekarang = new Date();
  7.         System.out.println("Waktu Sekarang adalah : " + waktuSekarang + "\n");
  8.        
  9.         // Menampilkan format waktu yang diinginkan
  10.         SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/YYYY");
  11.         System.out.println("Tanggal Sekarang adalah : " + dateFormat.format(waktuSekarang));
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement