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[] argv) throws Exception {

    Format formatter = new SimpleDateFormat("yy");
    String s = formatter.format(new Date());
    System.out.println(s);// w  w w  .j  a  v  a2 s  .  c o m
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("MM");
    String s = formatter.format(new Date());
    System.out.println(s);//from  ww w.j  a  v  a 2  s.c o m
}

From source file:Main.java

public static void main(String[] args) {

    GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();

    // set gregorian change at another date
    cal.setGregorianChange(new Date());
    System.out.println("Gregorian Change Date" + cal.getGregorianChange());

}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("dd");
    String s = formatter.format(new Date());
    System.out.println(s);//www  .  j av  a2s .c om
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("z");
    String s = formatter.format(new Date());
    System.out.println(s);/* w  ww . j  av a2 s.  com*/

}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("MMM");
    String s = formatter.format(new Date());
    System.out.println(s);/*from  w w  w.  j  a  va2  s  .  c  o  m*/
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("EEEE");
    String s = formatter.format(new Date());
    System.out.println(s);/*ww w  . ja  v a  2  s.c om*/
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("yyyy");
    String s = formatter.format(new Date());
    System.out.println(s);/*from  w ww .  j a  v a2s  .c o m*/
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("MMMM");
    String s = formatter.format(new Date());
    System.out.println(s);/*from  w ww  . j  av  a 2 s.com*/
}

From source file:Main.java

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

    Format formatter = new SimpleDateFormat("zzzz");
    String s = formatter.format(new Date());
    System.out.println(s);/*w w  w .ja  v  a  2s.  c o m*/

}