Package jodd.datetime

Examples of jodd.datetime.JDateTime


  }

  // ---------------------------------------------------------------- configure

  public void configure(TimeBefore annotation) {
    time = new JDateTime(annotation.value());
  }
View Full Code Here


  public static boolean validate(Object value, JDateTime then) {
    if (value == null) {
      return true;
    }
    JDateTime now = Convert.toJDateTime(value);
    return now.isBefore(then);
  }
View Full Code Here

    assertEquals(new DateTimeStamp(1234, 11, 12), dateTimeStamp);


    String timePattern = "YYYYMMDDhhmmssmss";

    JDateTime jdt = new JDateTime();

    String format = jdt.toString(timePattern);

    JDateTime jdt1 = new JDateTime();

    jdt1.parse(format, timePattern);

    assertEquals(jdt, jdt1);

  }
View Full Code Here

    assertEquals("Example <from@example.com>", email.getFrom().toString());
    assertEquals("to@example.com", email.getTo()[0].toString());
    assertEquals("test!", email.getSubject());

    // the time is specified in GMT zone
    JDateTime jdt = new JDateTime(2010, 3, 27, 12, 11, 21, 0);
    jdt.changeTimeZone(TimeZone.getTimeZone("GMT"), TimeZone.getDefault());

    // compare
    assertEquals(jdt.convertToDate(), email.getSentDate());

    Map<String, String> headers = email.getAllHeaders();
    assertEquals("1.0", headers.get("MIME-Version"));

    List<EmailMessage> messages = email.getAllMessages();
    assertEquals(2, messages.size());

    EmailMessage msg1 = messages.get(0);
    assertEquals("Test", msg1.getContent().trim());
    assertEquals("text/plain", msg1.getMimeType());
    assertEquals("us-ascii", msg1.getEncoding());

    EmailMessage msg2 = messages.get(1);
    assertTrue(msg2.getContent().contains("Test<o:p>"));
    assertEquals("text/html", msg2.getMimeType());
    assertEquals("us-ascii", msg2.getEncoding());

    List<EmailAttachment> attachments = email.getAttachments();
    assertNull(attachments);

    List<ReceivedEmail> attachedMessages = email.getAttachedMessages();
    assertNotNull(attachedMessages);
    assertEquals(1, attachedMessages.size());

    email = attachedMessages.get(0);

    // attached message

    assertEquals("Example <from@example.com>", email.getFrom().toString());
    assertEquals("to@example.com", email.getTo()[0].toString());
    assertEquals("test", email.getSubject());

    jdt = new JDateTime(2010, 3, 27, 12, 9, 46, 0);
    jdt.changeTimeZone(TimeZone.getTimeZone("GMT"), TimeZone.getDefault());
    assertEquals(jdt.convertToDate(), email.getSentDate());

    headers = email.getAllHeaders();
    assertEquals("1.0", headers.get("MIME-Version"));

    messages = email.getAllMessages();
View Full Code Here

    List<Area> areas = seatCategory.getAreas();
    assertEquals(11, areas.size());
    Area area = areas.get(0);
    assertEquals(205705999, area.getAreaId().longValue());
    assertEquals(0, area.getBlockIds().length);
    JDateTime start = performance.getStart();
    assertEquals(1372701600000L, start.getTimeInMillis());
    assertEquals("PLEYEL_PLEYEL", performance.getVenueCode());

    // seatCategoryNames

    map = catalog.getSeatCategoryNames();
View Full Code Here

    Tester2 tester2 = new Tester2();
    tester2.id = 1;
    tester2.name = "Hello";
    tester2.value = Integer.valueOf(123);
    tester2.time = new JDateTime(2014, 1, 30, 10, 42, 34, 0).convertToSqlTimestamp();
    tester2.time2 = new JDateTime(2014, 1, 31, 11, 41, 32, 0);

    DbOomQuery dbOomQuery = DbOomQuery.query(session, DbEntitySql.insert(tester2));
    dbOomQuery.setGeneratedKey();
    int result = dbOomQuery.executeUpdate();
View Full Code Here

    if (dbSqlType == Types.TIMESTAMP) {
      Timestamp timestamp = rs.getTimestamp(index);
      if (timestamp == null) {
        return null;
      }
      return new JDateTime(timestamp);
    }
    long time = rs.getLong(index);

    if (time == 0 && rs.wasNull()) {
      return null;
    }
    return new JDateTime(time);
  }
View Full Code Here

    foo.jdt2.setDay(3);
    foo.jdt2.setYear(2900);
    doq.executeUpdate();


    doq = new DbOomQuery(DbEntitySql.updateColumn(foo, "timestamp2", new JDateTime("2010-02-02 20:20:20.222")));

    doq.executeUpdate();

    foos = new DbOomQuery("select * from FOO").list(Foo.class);
    assertEquals(1, foos.size());
View Full Code Here

    assertFalse(MinConstraint.validate("12.1", 12.5));
  }

  @Test
  public void testTimeAfter() {
    assertTrue(TimeAfterConstraint.validate("2011-05-01 10:11:12.345", new JDateTime("2011-05-01 10:11:12.344")));
    assertFalse(TimeAfterConstraint.validate("2011-05-01 10:11:12.345", new JDateTime("2011-05-01 10:11:12.345")));
  }
View Full Code Here

    assertEquals(time, timestamp.getTime());
  }

  @Test
  public void testJDateTime2Timestamp() {
    JDateTime jdt = new JDateTime(time);
    Timestamp timestamp = sqlTimestampConverter.convert(jdt);
    assertEquals(time, timestamp.getTime());
  }
View Full Code Here

TOP

Related Classes of jodd.datetime.JDateTime

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.