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 {

    String s = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.CANADA).format(new Date());
    System.out.println(s);/*ww  w  .j av a  2 s  .c  o m*/
}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.LONG, Locale.CANADA).format(new Date());
    System.out.println(s);//from   www  .ja v  a2s.  c o  m

}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA).format(new Date());
    System.out.println(s);//  www  . j a v a 2s .c om

}

From source file:Main.java

public static void main(String[] args) {
    String timeStamp = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy", Locale.FRANCE).format(new Date());
    System.out.println(timeStamp);

}

From source file:SDF.java

public static final void main(String[] args) {
    SimpleDateFormat localDateFormat = new SimpleDateFormat("HH:mm:ss");
    String time = localDateFormat.format(new Date());
    System.out.println(time);/*w w w.  j a va  2s .co  m*/
}

From source file:Main.java

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

    String s = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.CANADA).format(new Date());
    System.out.println(s);/*from  w  w w.  java  2s  .  co  m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG);

    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getNumberFormat().getMinimumFractionDigits());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG);

    String s = dateFormat.format(new Date());
    System.out.println(s);/*w  w w.ja  v a2 s.c  o  m*/

}

From source file:Test.java

public static void main(String[] args) {
    long SAMPLE_NUMBER = 123456789L;
    Date NOW = new Date();
    System.out.printf("Creating from BCP 47 language tags...\n\n");
    String[] bcp47LangTags = { "fr-FR", "ja-JP", "en-US" };
    Locale l = null;/*  w  ww  .j a  v  a  2  s.c  o  m*/
    for (String langTag : bcp47LangTags) {
        l = Locale.forLanguageTag(langTag);
        displayLocalizedData(l, SAMPLE_NUMBER, NOW);
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Calendar cal = Calendar.getInstance();
    Date now = new Date();
    cal.setTime(now);//from  w w w. j  a v a2s.  c o m
    int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
    if (dayofweek == Calendar.SUNDAY)
        System.out.println("SUNDAY");
    if (dayofweek == Calendar.MONDAY)
        System.out.println("MONDAY");
    if (dayofweek == Calendar.TUESDAY)
        System.out.println("TUESDAY");
    if (dayofweek == Calendar.WEDNESDAY)
        System.out.println("WEDNESDAY");
    if (dayofweek == Calendar.THURSDAY)
        System.out.println("THURSDAY");
    if (dayofweek == Calendar.FRIDAY)
        System.out.println("FRIDAY");
    if (dayofweek == Calendar.SATURDAY) {
        System.out.println("SATURDAY");
    }
}