import java.net.*;
import java.io.*;
import java.util.Date;
public class last24 {
public static void main (String[] args) {
URL u;
URLConnection uc;
String thisLine;
// Initialize a Date object with the current date and time
Date today = new Date();
try {
u = new URL("http://www.ora.com");
uc = u.openConnection();
System.out.println("Will retrieve file if it's been modified since "
+ new Date(uc.getIfModifiedSince()).toLocaleString());
uc.setIfModifiedSince(Date.UTC(today.getYear(), today.getMonth(),
today.getDate() - 1, today.getHours(), today.getMinutes(),
today.getSeconds()));
System.out.println("Will retrieve file if it's been modified since "
+ new Date(uc.getIfModifiedSince()).toLocaleString());
}
catch (Exception e) {
System.err.println(e);
}
}
}
|