List of utility methods to do SQL Time Create
int | getYear(String dateTime) get Year Calendar c = Calendar.getInstance(); c.setTime(getDateTime(dateTime)); int year = c.get(1); return year; |
int | getYear(String dateTime) get Year Calendar c = Calendar.getInstance(); c.setTime(getDateTime(dateTime)); int year = c.get(c.YEAR); return year; |
Time | substract(Time thisDeparture, Time firstDeparture) substract Calendar firstCal = Calendar.getInstance(TimeZone.getDefault()); firstCal.setTime(firstDeparture); Calendar secondCal = Calendar.getInstance(TimeZone.getDefault()); secondCal.setTime(thisDeparture); secondCal.add(Calendar.HOUR_OF_DAY, 0 - firstCal.get(Calendar.HOUR_OF_DAY)); secondCal.add(Calendar.MINUTE, 0 - firstCal.get(Calendar.MINUTE)); secondCal.add(Calendar.SECOND, 0 - firstCal.get(Calendar.SECOND)); return new Time(secondCal.getTime().getTime()); ... |
Time | SumTime(Time t1, Time t2) Suma dos tiempos pasados long tm = 0; String[] arr = t1.toString().split(":"); tm += Integer.parseInt(arr[2]); tm += 60 * Integer.parseInt(arr[1]); tm += 3600 * Integer.parseInt(arr[0]); arr = t2.toString().split(":"); tm += Integer.parseInt(arr[2]); tm += 60 * Integer.parseInt(arr[1]); ... |
Time | sumTimes(String[] timeStrings, DateFormat df) sum Times int secs = 0, mins = 0, hrs = 0; Calendar calendar = Calendar.getInstance(); for (int i = 0; i < timeStrings.length; i++) { String dateString = timeStrings[i]; Date date = new Date(); try { date = (Date) df.parse(dateString); } catch (ParseException e) { ... |
Double | time2Double(java.sql.Time time) time Double if (time != null) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time.getTime()); double hour = c.get(Calendar.HOUR_OF_DAY); double minuten = c.get(Calendar.MINUTE); double sekunden = c.get(Calendar.SECOND); double minutendecimal = minuten / 60; double sekundendecimal = sekunden / 3600; ... |
String | time2String(final java.sql.Time value) Time to String format return value.toString();
|
byte[] | timeToBytes(Time t) time To Bytes Calendar cal = Calendar.getInstance(); cal.setTime(t); byte[] b = new byte[8]; b[0] = (byte) 0; b[1] = (byte) (19 & 0xff); b[2] = (byte) (70 & 0xff); b[3] = (byte) (1 & 0xff); b[4] = (byte) (1 & 0xff); ... |
Calendar | timeToCalendar(Time input) time To Calendar java.util.Calendar output = Calendar.getInstance();
output.setTimeInMillis(input.getTime());
return output;
|
int | timeToInternal(java.sql.Time time) Converts the Java type used for UDF parameters of SQL TIME type ( java.sql.Time ) to internal representation (int). return timeToInternal(time, UTC_ZONE);
|