package com.csc.library.utilities; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class CheckTime { int h, m, s; Date d; GregorianCalendar cal; public CheckTime() { cal = new GregorianCalendar(); d = new Date(); cal.setTime(d); this.s = (int) cal.get(Calendar.SECOND); this.m = (int) cal.get(Calendar.MINUTE); this.h = (int) cal.get(Calendar.HOUR_OF_DAY); } public int getTime() { //the time is return in minute this.h = (h + 7 >= 24) ? h = h - 24 : h; return (this.h * 60 * 60) + (this.m * 60) + this.s; } }