Java SQL Time Create timeToBytes(Time t)

Here you can find the source of timeToBytes(Time t)

Description

time To Bytes

License

Apache License

Declaration

public static byte[] timeToBytes(Time t) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.Time;

import java.util.Calendar;

public class Main {
    public static byte[] timeToBytes(Time t) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(t);//from   w w  w.j a v  a 2  s.c o m

        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);
        b[5] = (byte) (cal.get(Calendar.HOUR) & 0xff);
        b[6] = (byte) (cal.get(Calendar.MINUTE) & 0xff);
        b[7] = (byte) (cal.get(Calendar.SECOND) & 0xff);
        return b;
    }
}

Related

  1. substract(Time thisDeparture, Time firstDeparture)
  2. SumTime(Time t1, Time t2)
  3. sumTimes(String[] timeStrings, DateFormat df)
  4. time2Double(java.sql.Time time)
  5. time2String(final java.sql.Time value)
  6. timeToCalendar(Time input)
  7. timeToInternal(java.sql.Time time)
  8. timeToLong(Object timeObj)
  9. timeToString(java.sql.Time a_Time, String aS_Format)