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:MainClass.java

public static void main(String args[]) throws Exception {

    Date date = new Date();
    System.out.printf("The DATE is %tR\n", date);

}

From source file:Main.java

public static void main(String[] args) {
    java.sql.Timestamp ts1 = java.sql.Timestamp.valueOf("2012-04-06 09:01:10");

    ts1.setTime(new Date().getTime());
    System.out.println(ts1);// w  w  w.  j a  va 2s  . c  om

}

From source file:DateNumberSample.java

public static void main(String args[]) {
    Double kb = new Double(3.5);
    Date today = new Date();

    String pattern = "{0}K was deleted on {1}.";
    Object[] arguments = { kb, today };
    System.out.println(MessageFormat.format(pattern, arguments));
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {

    Date date = new Date();
    System.out.printf("The DATE is %tT\n", date);

}

From source file:Main.java

public static void main(String[] argv) {
    System.out.println(getDateMap(new Date()));
}

From source file:Main.java

public static void main(String[] args) {

    System.out.println(toZonedDateTime(new Date()));
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();
    String strDateFormat = "E";
    SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
    System.out.println("Current day of week in E format : " + sdf.format(date));

}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Double kb = new Double(3.5);
    Date today = new Date();

    String pattern = "{0}K was deleted on {1}.";
    Object[] arguments = { kb, today };
    System.out.println(MessageFormat.format(pattern, arguments));
}

From source file:Main.java

public static void main(String[] args) {
    Date d1 = new Date();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, 22);/*from  w  ww .j  a va  2  s.c  o  m*/
    Date d2 = cal.getTime();

    Iterator<Date> i = new DateIterator(d1, d2);
    while (i.hasNext()) {
        Date date = i.next();
        System.out.println(date);
    }
}

From source file:Main.java

public static void main(String[] args) {
    Date d = new Date();
    System.out.println(d);/*from   ww  w  . j av  a2  s.  c o  m*/

    DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    df.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
    System.out.println(df.format(d));
    df.setTimeZone(TimeZone.getTimeZone("Europe/London"));
    System.out.println(df.format(d));
}