Created
April 24, 2015 10:36
-
-
Save mresetar/28799c4fd518878f7158 to your computer and use it in GitHub Desktop.
Prints current system date and time from Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.text.*; | |
/** | |
* First compile class: c:\java\jdk1.7.0_71\bin\javac.exe DateDemo.java | |
* Secondly run it with: java -cp . DateDemo | |
*/ | |
public class DateDemo { | |
public static void main(String args[]) { | |
final Date dNow = new Date( ); | |
final SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); | |
System.out.println("Current Date: " + ft.format(dNow)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment