APISonar


java.sql.Date.Date

> java > sql > Date > Date
java APIs sql APIs Date APIs Date APIs

Example 1
public Date maxValue()
    {

        return new Date(Long.MAX_VALUE);
    }
Example 2
void testSqlDate2SqlDate() {
		Date date2 = new Date(time);
		Date date = sqlDateConverter.convert(date2);
		assertEquals(time, date.getTime());
	}
Example 3
private Date getNextEndDate() {
    
        return  new Date(System.currentTimeMillis() + 1);
    }
Example 4
protected Date[] getTestData() {
		return new Date[] {
			new Date(0L),
			Date.valueOf("1970-01-01"),
			Date.valueOf("1990-10-14"),
			Date.valueOf("2013-08-12"),
			Date.valueOf("2040-05-12")
		};
	}
Example 5
public Date getDate( int index ) throws SQLException {
    try {
      java.util.Date date = rowMeta.getDate( currentRow, index - 1 );
      if ( date == null ) {
        lastNull = true;
        return null;
      }
      lastNull = false;
      return new Date( date.getTime() );
    } catch ( Exception e ) {
      throw new SQLException( e );
    }
  }
Example 6
public T parse(String value) {
    try {
      long epochMillis = Long.parseLong(value);
      return convertFromDate(new Date(epochMillis));
    } catch (NumberFormatException e) {
      Date date = Date.valueOf(value);
      return convertFromDate(date);
    }
  }
Example 7
public void test19() {

        Date d = Date.valueOf("1961-08-30");
        Date d2 = new Date(d.getTime());
        assertTrue(d.equals(d2), "Error d != d2");
    }
Example 8
static Date asDate(String date) {
        ZonedDateTime zdt = asDateTime(date);
        return new Date(zdt.toLocalDate().atStartOfDay(zdt.getZone()).toInstant().toEpochMilli());
    }
Example 9
public void testXmlGregorianCalendar() {
        XMLGregorianCalendar xmlCalendar = mock(XMLGregorianCalendar.class);
        GregorianCalendar expected = new GregorianCalendar();
        when(xmlCalendar.toGregorianCalendar()).thenReturn(expected);

        Date date = new Date(expected.getTimeInMillis());

        assertEquals(date, converter.convert(Date.class, xmlCalendar));
    }
Example 10
public T readData(DataInput dataInput) throws IOException {
    if (!dataInput.readBoolean()) {
      return null;
    } else {
      long val = dataInput.readLong();
      Date date = new Date(val);
      return convertFromDate(date);
    }
  }
Example 11
public Date parseDate(String strValue) {
    Date result = new Date(0);
    if (parseDate(strValue, result)) {
      return result;
    }
    return null;
  }
Example 12
private Date internalToDate(int v) {
		final long t = v * MILLIS_PER_DAY;
		return new Date(t - LOCAL_TZ.getOffset(t));
	}
Example 13
private Object getMaxValue()
    {
        return new Date(2100, 1, 1);
    }
Example 14
public void test_2() throws Exception {
        Date t = new Date(System.currentTimeMillis());

        String text = JSON.toJSONString(t);

        Date t1 = JSON.parseObject(text, Date.class);
        Assert.assertEquals(t, t1);
    }
Example 15
public Date dateChange(Date in, boolean add) {
    Calendar c = Calendar.getInstance();
    c.setTimeInMillis(in.getTime());
    calendarChange(c, add);
    return new Date(c.getTimeInMillis());
  }
Example 16
public Date getDate(String name)
    {
        return new Date(Long.parseLong(getFieldValue(name)));
    }
Example 17
public DateTimeIT() throws Exception {
        super();
        date = new Date(System.currentTimeMillis());
    }
Example 18
public void testInternalPrecision() {
    long millis = System.currentTimeMillis();
    Date now = new Date(millis);
    Date after = new Date(now.getTime() + 1);
    Date before = new Date(now.getTime() - 1);

    // Note that Dates internally retain millisecond precision
    assertTrue(after.after(now));
    assertTrue(before.before(now));
  }
Example 19
public void formatParse_PG_DATE_POSITIVE_INFINITY() {

    Date postgresInfinityDate = new Date(9223372036825200000L);

    String format = type.formatValue(postgresInfinityDate);
    Date parsed = type.parse(format);
    assertEquals(parsed, postgresInfinityDate);
  }
Example 20
public T convertFromMillis(long systemTimeMillis) {
    Date ts = new Date(systemTimeMillis);
    return convertFromDate(ts);
  }
Example 21
protected Date getDateOfCurrentPeriodsStart() {
        long delta = currentTime % 1000;
        return new Date(currentTime - delta);
    }
Example 22
private void assertDateEquals(
            String expected, int year, int month, int day, int hour, String timezoneId)
            throws Exception {
        Calendar calendar = calendarOf(year, month, day, hour, timezoneId);
        java.util.Date utilDate = calendar.getTime();
        Date date = new Date(utilDate.getTime());
        assertEquals(expected, sut1Convert(date));
        assertEquals(expected, sut2Convert(date));
    }
Example 23
public Date deserialize(Object data) {
		if (data == null) {
			return null;
		}

		return new Date((Long) data);
	}
Example 24
void setUp() {
        minDate = new Date(1460448795091L);
        maxDate = new Date(1460448795179L);
        randomizer = aNewSqlDateRangeRandomizer(minDate, maxDate);
    }
Example 25
public Date getDate(String name) {
        Long epoch = getEpoch(name);

        if (epoch == null) {
            return null;
        }

        return new Date(epoch);
    }