Package java.sql

Examples of java.sql.Time


        assertEquals(cal.get(Calendar.DATE), 30);
    }
   
    public void testCreateTime() {
        Timestamp t = Timestamp.valueOf("2004-06-30 23:39:10.1201"); //$NON-NLS-1$
        Time date = TimestampWithTimezone.createTime(t);
       
        Calendar cal = Calendar.getInstance();
       
        cal.setTimeInMillis(date.getTime());
       
        assertEquals(cal.get(Calendar.HOUR_OF_DAY), 23);
        assertEquals(cal.get(Calendar.MINUTE), 39);
        assertEquals(cal.get(Calendar.SECOND), 10);
        assertEquals(cal.get(Calendar.MILLISECOND), 0);
View Full Code Here


      return null;
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, writeHour);
    if(writeMinute >=0 && writeMinute <60)
      cal.set(Calendar.MINUTE, writeMinute);
    return new Time(cal.getTime().getTime());
  }
View Full Code Here

        rs.addColumn("j", Types.TIMESTAMP, 0, 0);

        Date d = Date.valueOf("2001-02-03");
        byte[] b = {(byte) 0xab};
        Object[] a = {1, 2};
        Time t = Time.valueOf("10:20:30");
        Timestamp ts = Timestamp.valueOf("2002-03-04 10:20:30");
        rs.addRow(1, b, true, d, "10.3", Math.PI, "-3", a, t, ts);

        rs.next();
View Full Code Here

        stat.execute("INSERT INTO TEST VALUES(1, '2001-01-01', '20:00:00', '2002-02-02 22:22:22.2')");
        stat.execute("INSERT INTO TEST VALUES(1, '2001-01-01', '20:00:00', '2002-02-02 22:22:22.2')");
        ResultSet rs = stat.executeQuery("SELECT * FROM TEST");
        rs.next();
        Date d1 = rs.getDate("D");
        Time t1 = rs.getTime("T");
        Timestamp ts1 = rs.getTimestamp("TS");
        rs.next();
        Date d2 = rs.getDate("D");
        Time t2 = rs.getTime("T");
        Timestamp ts2 = rs.getTimestamp("TS");
        assertTrue(ts1 != ts2);
        assertTrue(d1 != d2);
        assertTrue(t1 != t2);
        assertTrue(t2 != rs.getObject("T"));
View Full Code Here

            }
            testValue(ValueDecimal.get(new BigDecimal(i * i)));
        }
        testValue(ValueDate.get(new Date(System.currentTimeMillis())));
        testValue(ValueDate.get(new Date(0)));
        testValue(ValueTime.get(new Time(System.currentTimeMillis())));
        testValue(ValueTime.get(new Time(0)));
        testValue(ValueTimestamp.get(new Timestamp(System.currentTimeMillis())));
        testValue(ValueTimestamp.get(new Timestamp(0)));
        testValue(ValueJavaObject.getNoCopy(new byte[0]));
        testValue(ValueJavaObject.getNoCopy(new byte[100]));
        for (int i = 0; i < 300; i++) {
View Full Code Here

       
        // Get timestamp literal and break into pieces
        Timestamp ts = (Timestamp) timestampConstant.getValue();
        String tsStr = ts.toString();
        Date date = Date.valueOf(tsStr.substring(0, 10));
        Time time = Time.valueOf(tsStr.substring(11, 19));
       
        // Get timestampCreate args
        Expression[] args = tsCreateFunction.getArgs();
       
        // Rebuild the function
View Full Code Here

      appRemote.setDataSource(dataSource);

      HashMap hm = (HashMap)appRemote.getCalendarSettings();

      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("h:mm a");
      Time startTime = (Time)hm.get("starttime");
      Time endTime = (Time)hm.get("endtime");
     
      try {
        dynaform.set("startTime", simpleDateFormat.format(startTime));
      } catch (Exception e) {
        dynaform.set("startTime", "8:00 AM");       
View Full Code Here

      AppSettingsHome appHome = (AppSettingsHome)CVUtility.getHomeObject("com.centraview.administration.applicationsettings.AppSettingsHome", "AppSettings");
      AppSettings appRemote = appHome.create();
      appRemote.setDataSource(dataSource);
     
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("h:mm a");
      Time startTime;
      Time endTime;
      try {
        Date tempDate = simpleDateFormat.parse(dynaform.get("startTime").toString());
        startTime = new Time(tempDate.getTime());
      } catch (Exception e) {
        Date tempDate = simpleDateFormat.parse("8:00 AM");
        startTime = new Time(tempDate.getTime());
      }
     
      try {
        Date tempDate = simpleDateFormat.parse(dynaform.get("endTime").toString());
        endTime = new Time(tempDate.getTime());
      } catch (Exception e) {
        Date tempDate = simpleDateFormat.parse("5:00 PM");
        endTime = new Time(tempDate.getTime());
      }
     
      appRemote.updateCalendarSettings(startTime.toString(), endTime.toString(),  dynaform.get("workingdays").toString());

      if (button.equals("save")) {
        returnStatus = "save";
        FORWARD_final = FORWARD_save;
      } else if (button.equals("saveandclose")) {
View Full Code Here

  {
    int startHrs = 0;
    int startMins = 0;
    int endHrs = 0;
    int endMins = 0;
    Time tStartTime, tEndTime = null;

    form.set("hostName", svo.getHostName());
    form.set("sessionTimeout", String.valueOf(svo.getSessionTimeout()));
    form.set("emailCheckInterval", String.valueOf(svo.getEmailCheckInterval()));
    form.set("fileSystemStoragePath", svo.getFileSystemStoragePath());
View Full Code Here

                              new Float(i),
                              new Integer(i),
                              new Long(i),
                              new Short((short)i),
                              sampleString(i),
                              new Time(currentTime),
                              new Timestamp(currentTime)
                            };
            batch[i] = Arrays.asList(data);
        }
        return batch;
View Full Code Here

TOP

Related Classes of java.sql.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.