Don't Give Up in Life …

Menampilkan Tanggal dan Jam

//menampilkan Tanggal dan jam
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
public class Tanggal {

public static void main(String[] args) {
Date tanggal = new Date();

SimpleDateFormat sdf = new SimpleDateFormat(“dd-MM-yyyy”);
JOptionPane.showInputDialog(“Tanggal Sekarang”,sdf.format(tanggal));
sdf = new SimpleDateFormat(“HH:mm:ss”);

JOptionPane.showInputDialog(“Jam Sekarang”,sdf.format(tanggal));

Save dengan “”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: