FileDocCategorySizeDatePackage
timeContentHandler.javaAPI DocExample660Thu Apr 03 15:28:00 BST 1997None

timeContentHandler.java

import java.net.*;
import java.io.*;
import java.util.*;

public class timeContentHandler extends ContentHandler {

  public Object getContent(URLConnection uc) {
  
    Date now = null;
     
    try {  
      DataInputStream dis = new DataInputStream(uc.getInputStream());   
      int theTime = dis.readInt();
      // 86400 seconds a day
      // midnight January 1970 = 2,208,988,800 seconds since midnight January 1, 1900
      long secondsSince1970 = theTime - 2208988800L;
      long millisecondsSince1970 = secondsSince1970 * 1000L;
      now = new Date(millisecondsSince1970);
    }
    catch (IOException e) {
    }
      
    return now;
  
  }

}