Examples of Timestamp


Examples of java.sql.Timestamp

      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, site.getId());
      q.setInteger(1, TopicOutlineBean.STATUS_NORMAL);
      Calendar cur_time = Calendar.getInstance();
      cur_time.add(Calendar.DATE, -days);
      q.setTimestamp(2, new Timestamp(cur_time.getTime().getTime()));
      if(forum != null)
        q.setInteger(3, forum.getId());
      if(fromIdx > 0)
        q.setFirstResult(fromIdx);
      q.setMaxResults(count);
View Full Code Here

Examples of java.sql.Timestamp

        }
    }
   
    private static class TimestampColumnSerializer extends ColumnSerializer {
        protected void writeObject(ObjectOutput out, Object obj) throws IOException {
            Timestamp ts =  (Timestamp)obj;
            out.writeLong(ts.getTime());
            out.writeInt(ts.getNanos());
        }
View Full Code Here

Examples of java.sql.Timestamp

     */
    public static Timestamp createTimestamp(int year, int month, int date, int hour, int minute, int second, int nano) {
        primeCalendar();
        CAL.get().set(year + 1900, month, date, hour, minute, second);
        long millis = CAL.get().getTime().getTime();
        Timestamp ts = new Timestamp(millis);
        ts.setNanos(nano);
        return ts;
    }
View Full Code Here

Examples of java.sql.Timestamp

   * @throws TransformationException if value is an incorrect input type or
   * the transformation fails
   */
  public Object transformDirect(Object value) throws TransformationException {
    value = ((String) value).trim();
    Timestamp result = null;
    try {
      result = Timestamp.valueOf( (String) value );
    } catch(Exception e) {
      throw new TransformationException(e, "ERR.003.029.0024", CorePlugin.Util.getString("ERR.003.029.0024", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    //validate everything except for fractional seconds
    if (!((String)value).startsWith(result.toString().substring(0, 19))) {
      throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
    }
    return result;
  }
View Full Code Here

Examples of java.sql.Timestamp

        assertEquals(expected, getString(TestLiteralImpl.example(Boolean.TRUE)));
        long now = System.currentTimeMillis();
        Date date = new Date(now);
        expected = "{d '" + date.toString() + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
        assertEquals(expected, getString(TestLiteralImpl.example(date)));
        Timestamp ts = new Timestamp(now);
        expected = "{ts '" + ts.toString() + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
        assertEquals(expected, getString(TestLiteralImpl.example(ts)));
        Time t = new Time(now);
        expected = "{t '" + t.toString() + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
        assertEquals(expected, getString(TestLiteralImpl.example(t)));
    }
View Full Code Here

Examples of java.sql.Timestamp

    }

    // Source = TIMESTAMP
   
    public void testTimestampToString() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts '2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts '2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    public void testTimestampToDate() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts '2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts '2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    public void testTimestampToTime() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts '2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

     
      Argument object = params.get(OBJECT);
      String objectName = (String) object.getArgumentValue().getValue();
     
      Argument start = params.get(STARTDATE);
      Timestamp startTime = (Timestamp) start.getArgumentValue().getValue();
      GregorianCalendar tempCalendar = (GregorianCalendar) GregorianCalendar.getInstance();
      tempCalendar.setTime(startTime);
      XMLGregorianCalendar startCalendar = factory.newXMLGregorianCalendar(tempCalendar);
     
      Argument end = params.get(ENDDATE);
      Timestamp endTime = (Timestamp) end.getArgumentValue().getValue();
      tempCalendar = (GregorianCalendar) GregorianCalendar.getInstance();
      tempCalendar.setTime(endTime);
      XMLGregorianCalendar endCalendar = factory.newXMLGregorianCalendar(tempCalendar);
     
      updatedResult = parent.getConnection().getUpdated(objectName, startCalendar, endCalendar);
View Full Code Here

Examples of java.sql.Timestamp

        stat.execute("CREATE ALIAS testCall FOR \"" + getClass().getName() + ".testCall\"");
        call = conn.prepareCall("{CALL testCall(?,?,?)}");
        call.setInt("A", 100);
        call.setString(2, "abc");
        long t = System.currentTimeMillis();
        call.setTimestamp("C", new Timestamp(t));
        call.registerOutParameter(1, Types.INTEGER);
        call.registerOutParameter("B", Types.VARCHAR);
        call.executeUpdate();
        try {
            call.getTimestamp("C");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.