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

@Deprecated
public Date(String s) 

Source Link

Document

Allocates a Date object and initializes it so that it represents the date and time indicated by the string s , which is interpreted as if by the Date#parse method.

Usage

From source file:Main.java

public static void main(String[] args) {
    Date d = new Date(365L * 24L * 60L * 60L * 1000L);
    System.out.println(d);
}

From source file:MainClass.java

public static void main(String[] args) {
    Date date = new Date(1111111111);
    System.out.println(date);
}

From source file:Main.java

public static void main(String[] args) {
    Date d = new Date(365L * 24L * 60L * 60L * 1000L + 99999999L);
    System.out.println(d);
}

From source file:Main.java

public static void main(String[] args) {
    File file = new File("C://FileIO//demo.txt");
    System.out.println("last modifed:" + new Date(file.lastModified()));
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    File fileToChange = new File("C:/myfile.txt");

    Date filetime = new Date(fileToChange.lastModified());
    System.out.println(filetime.toString());

    System.out.println(fileToChange.setLastModified(System.currentTimeMillis()));

    filetime = new Date(fileToChange.lastModified());
    System.out.println(filetime.toString());

}

From source file:Main.java

public static void main(String[] args) {
    File file = new File("Main.java");
    Long lastModified = file.lastModified();
    Date date = new Date(lastModified);
    System.out.println(date);/*  w ww . ja  va 2  s.c o  m*/
}

From source file:MainClass.java

public static void main(String[] args) {
    // Create an object that is a directory
    File myDir = new File("C:/Java_Dev");
    System.out.println(new Date(myDir.lastModified()));
}

From source file:Main.java

public static void main(String[] argv) {
    System.out.println(getDatesInPeriod(new Date(1422312311223L), new Date(1462312311223L)));
}

From source file:Main.java

public static void main(String[] args) {
    Timestamp timestamp = new Timestamp(System.currentTimeMillis());
    Date date = new Date(timestamp.getTime());

    // S is the millisecond
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy' 'HH:mm:ss:S");

    System.out.println(simpleDateFormat.format(timestamp));
    System.out.println(simpleDateFormat.format(date));
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
    System.out.println(new Date(mx.getStartTime()));
}