Example usage for java.util Date Date

List of usage examples for java.util Date Date

Introduction

In this page you can find the example usage for java.util Date Date.

Prototype

public Date() 

Source Link

Document

Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.

Usage

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();
    Package pack = date.getClass().getPackage();
    String packageName = pack.getName();
    System.out.println("Package Name = " + packageName);

}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("two-digit year: %ty/%Ty\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("two-digit century: %tC/%TC\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("hours, minutes, and seconds on a 12-hour clock: %tr/%Tr\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("two-digit day of the month: %td/%Td\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("three-digit day of the year: %tj/%Tj\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("ISO 8601 standard date: %tF/%TF\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("Unix date format: %tc/%Tc\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("month/day/year: %tD/%TD\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("nanoseconds: %tN/%TN\n", now, now);
}