Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public class Timeconversion
{
DateFormat dfm = new SimpleDateFormat("yyyyMMddHHmm");
long unixtime;
public long timeConversion(String time)
{
dfm.setTimeZone(TimeZone.getTimeZone("GMT 5:30"));//Specify your timezone
try
{
unixtime = dfm.parse(time).getTime();
unixtime=unixtime/1000;
}
catch (ParseException e)
{
e.printStackTrace();
}
return unixtime;
}
}