public static Byte[] convertDate(String date){
  StringTokenizer st=new StringTokenizer(date);
  String sdate=st.nextToken();
  String stime=st.nextToken();
  st=new StringTokenizer(sdate,"-");
  String year=st.nextToken();
  int iyear=0;
  try {
    iyear=Integer.parseInt(year);
  }
 catch (  NumberFormatException ex) {
    debug.error("MonitoringUtil.convertDate year = " + year + " not parsable");
  }
  byte yrlow=(byte)(iyear & 0xff);
  byte yrhigh=(byte)(((iyear & 0xff00) >> 8) & 0xff);
  String month=st.nextToken();
  String day=st.nextToken();
  st=new StringTokenizer(stime,":");
  String hour=st.nextToken();
  String min=st.nextToken();
  String sec=st.nextToken();
  Byte bz=Byte.valueOf((byte)0);
  Byte byrhi=bz;
  Byte byrlo=bz;
  Byte bmo=bz;
  Byte bdy=bz;
  Byte bhr=bz;
  Byte bmn=bz;
  Byte bsc=bz;
  try {
    byrhi=new Byte(yrhigh);
    byrlo=new Byte(yrlow);
    bmo=new Byte(month);
    bdy=new Byte(day);
    bhr=new Byte(hour);
    bmn=new Byte(min);
    bsc=new Byte(sec);
  }
 catch (  NumberFormatException ex) {
    debug.error("MonitoringUtil error converting start date/time" + ", date = " + sdate + ", time = "+ stime);
  }
  Byte[] ret=new Byte[8];
  ret[0]=byrhi;
  ret[1]=byrlo;
  ret[2]=bmo;
  ret[3]=bdy;
  ret[4]=bhr;
  ret[5]=bmn;
  ret[6]=bsc;
  ret[7]=bz;
  return ret;
}

public static Byte [ ] convertDate ( String date ) { StringTokenizer st = new StringTokenizer ( date ) ; String sdate = st . nextToken ( ) ; String stime = st . nextToken ( ) ; st = new StringTokenizer ( sdate , "-" ) ; String year = st . nextToken ( ) ; int iyear = 0 ; try { iyear = Integer . parseInt ( year ) ; } catch ( NumberFormatException ex ) { debug . error ( "MonitoringUtil.convertDate year = " + year + " not parsable" ) ; } byte yrlow = ( byte ) ( iyear & 0xff ) ; byte yrhigh = ( byte ) ( ( ( iyear & 0xff00 ) > > 8 ) & 0xff ) ; String month = st . nextToken ( ) ; String day = st . nextToken ( ) ; st = new StringTokenizer ( stime , ":" ) ; String hour = st . nextToken ( ) ; String min = st . nextToken ( ) ; String sec = st . nextToken ( ) ; Byte bz = Byte . valueOf ( ( byte ) 0 ) ; Byte byrhi = bz ; Byte byrlo = bz ; Byte bmo = bz ; Byte bdy = bz ; Byte bhr = bz ; Byte bmn = bz ; Byte bsc = bz ; try { byrhi = new Byte ( yrhigh ) ; byrlo = new Byte ( yrlow ) ; bmo = new Byte ( month ) ; bdy = new Byte ( day ) ; bhr = new Byte ( hour ) ; bmn = new Byte ( min ) ; bsc = new Byte ( sec ) ; } catch ( NumberFormatException ex ) { debug . error ( "MonitoringUtil error converting start date/time" + ", date = " + sdate + ", time = " + stime ) ; } Byte [ ] ret = new Byte [ 8 ] ; ret [ 0 ] = byrhi ; ret [ 1 ] = byrlo ; ret [ 2 ] = bmo ; ret [ 3 ] = bdy ; ret [ 4 ] = bhr ; ret [ 5 ] = bmn ; ret [ 6 ] = bsc ; ret [ 7 ] = bz ; return ret ; }
date / time format is " yyyy - mm - dd hh : mm : ss " it should be an 8 - byte array , where bytes 0 - 1 : year byte 2 : month byte 3 : day byte 4 : hours byte 5 : minutes byte 6 : seconds byte 7 : deci - seconds ( will be 0 )
