Source Code : Get Local Epoch

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Get Local Epoch

        
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.TimeZone;

public class Util{
    public static long getLocalEpoch(TimeZone timezone)
    {
        DateFormat dateFormat = DateFormat.getInstance();
        if (timezone != null)
            dateFormat.setTimeZone(timezone);
        long result = 0;
        try
        {
            result = DateFormat.getInstance().parse("01/02/70 12:00 AM").getTime();
        }
        catch (ParseException e)
        {
            
        }

        if (dateFormat.getTimeZone().inDaylightTime(new Date()))
        {
            result -= 60*60*1000;
        }
        return result;
    }
}

   
    
    
    
    
    
    
    
  

Thank with us