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();

    System.out.println("Date is : " + date);
    System.out.println("Milliseconds since January 1, 1970, 00:00:00 GMT : " + date.getTime());
}

From source file:DateDemo.java

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

    System.out.println(date);/*ww w  .  ja  v  a  2s .com*/

    long msec = date.getTime();
    System.out.println("Milliseconds since Jan. 1, 1970 GMT = " + msec);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("localized day name: %tA/%TA\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 24-hour clock: %tT/%TT\n", now, now);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("localized, abbreviated day: %ta/%Ta\n", now, now);
}

From source file:Main.java

public static void main(String[] args) {

    Date date = new Date();

    int i = date.hashCode();
    System.out.println(i);/*from w  w w .  j av  a  2  s.co  m*/
}

From source file:MainClass.java

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

From source file:MainClass.java

public static void main(String[] args) {
    Date now = new Date();
    System.out.printf("hours and minutes on a 24-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("four 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("a one-or-two-digit day of the month: %te/%Te\n", now, now);
}