本文整理了Java中org.activityinfo.model.type.time.LocalDate
类的一些代码示例,展示了LocalDate
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate
类的具体详情如下:
包路径:org.activityinfo.model.type.time.LocalDate
类名称:LocalDate
[英]FieldValue of type LocalDateType
[中]LocalDateType类型的FieldValue
代码示例来源:origin: bedatadriven/activityinfo
@Override
public LocalDate getLastUsedDate() {
return new LocalDate();
}
}
代码示例来源:origin: bedatadriven/activityinfo
@SuppressWarnings("deprecation")
public static LocalDate fromDayOfYear(int year, int dayOfYear) {
// Use deprecated Date API because it compiles directly to Javascript builtin.
Date jan1 = new LocalDate(year, 1, 1).atMidnightInMyTimezone();
jan1.setDate(dayOfYear);
return new LocalDate(jan1);
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public ColumnView columnApply(int numRows, List<ColumnView> arguments) {
return new ConstantColumnView(numRows, new LocalDate(new Date()).toString());
}
}
代码示例来源:origin: bedatadriven/activityinfo
/**
* @return true if the {@code other} interval overlaps this interval with at least one day.
*/
public boolean overlaps(LocalDateInterval other) {
// Either the other interval finishes before this interval starts...
// .. or it starts after this interval finishes
return !(other.endDate.before(this.startDate) ||
other.startDate.after(this.endDate));
}
代码示例来源:origin: bedatadriven/activityinfo
public static int encodeLocalDate(LocalDate value) {
return value.getYear() << 16 | value.getMonthOfYear() << 8 | value.getDayOfMonth();
}
代码示例来源:origin: bedatadriven/activityinfo
public static LocalDate getLastDateOfMonth(int year, int month) {
return new LocalDate(year, month, getLastDayOfMonth(year, month));
}
代码示例来源:origin: bedatadriven/activityinfo
public void setDate1(FieldValue value) {
if(value != null) {
this.date1 = ((LocalDate) value).atMidnightInMyTimezone();
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
@SuppressWarnings("deprecation")
public Date parse(CharSequence text) throws ParseException {
// Use a very lenient parser to allow for local input.
// The result will always be formatted as a formatted string
Date date;
try {
date = PARSER.parse(text.toString()).atMidnightInMyTimezone();
} catch (IllegalArgumentException e) {
throw new ParseException(text.toString(), 0);
}
LocalDate localDate = new LocalDate(date);
if(localDate.getYear() < 1000 || localDate.getYear() > 9999) {
throw new ParseException(text.toString(), 0);
}
return date;
}
代码示例来源:origin: bedatadriven/activityinfo
static boolean isSnoozed(AccountStatus status, String snoozePrefix) {
try {
Storage storage = Storage.getLocalStorageIfSupported();
if(storage == null) {
return false;
}
String accountSnooze = storage.getItem(snoozePrefix + status.getUserAccountId());
if(accountSnooze == null) {
return false;
}
LocalDate snoozeDate = LocalDate.parse(accountSnooze);
LocalDate today = new LocalDate();
if(today.before(snoozeDate)) {
return true;
} else {
return false;
}
} catch (Exception e) {
return false;
}
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public void setValue(Cell cell, int row) {
// Excel does not support date values prior to 1900,
// so we have no choice but to render the value as text if the date occurs
// prior to 1900.
LocalDate localDate = renderer.render(row);
if(localDate.getYear() < 1900) {
cell.setCellValue(localDate.toString());
} else {
cell.setCellValue(localDate.atMidnightInMyTimezone());
}
}
}
代码示例来源:origin: bedatadriven/activityinfo
private static FormulaNode dateValue(FilterConfig filter) {
// GXT serializes the date value as unix time value in milliseconds
long time = Long.parseLong(filter.getValue());
Date date = new Date(time);
LocalDate localDate = new LocalDate(date);
return new FunctionCallNode(DateFunction.INSTANCE,
new ConstantNode(localDate.getYear()),
new ConstantNode(localDate.getMonthOfYear()),
new ConstantNode(localDate.getDayOfMonth()));
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public void onSuccess(SqlTransaction tx, SqlResultSet results) {
LocalDate today = new LocalDate();
LocalDate trialEndDate;
if(!row.isNull("trialEndDate")) {
trialEndDate = new LocalDate(row.getDate("trialEndDate"));
} else {
trialEndDate = new LocalDate(2050,1,1);
db.setAccountEndDate(trialEndDate.toString());
db.setSuspended(trialEndDate.before(today));
} else {
db.setBillingAccountName(row.get("baName"));
db.setAccountEndDate(new LocalDate(row.getDate("baEndDate")).toString());
代码示例来源:origin: bedatadriven/activityinfo
NumberBlock block = (NumberBlock) BlockFactory.get(quantityField);
LocalDate startDate = new LocalDate(1980, 1, 1);
LocalDate date = startDate;
for (int j = 0; j < block.getBlockSize(); j++) {
block.update(blockEntity, j, date);
date = date.plusDays(1);
assertThat(view.getString(0), equalTo(startDate.toString()));
assertThat(view.getString(1), equalTo(startDate.plusDays(1).toString()));
assertThat(view.getString(2), equalTo(startDate.plusDays(3).toString()));
assertThat(view.getString(3), equalTo(startDate.plusDays(4).toString()));
assertThat(view.getString(block.getBlockSize()), equalTo(startDate.plusDays(block.getBlockSize() + 1).toString()));
assertThat(selected.getString(0), equalTo(startDate.plusDays(1).toString()));
代码示例来源:origin: bedatadriven/activityinfo
@Test
public void minDate() {
LocalDate afterMinDate = new LocalDate(2017,01,01);
assertTrue("Should be _after_ minimum date", afterMinDate.after(LocalDate.MIN_DATE));
LocalDate onMinDate = new LocalDate(1000,01,01);
assertTrue("Should be _on_ minimum date", onMinDate.equals(LocalDate.MIN_DATE));
LocalDate beforeMinDate = new LocalDate(99,01,01);
assertTrue("Should be _before_ minimum date", beforeMinDate.before(LocalDate.MIN_DATE));
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public Object toHrdProperty(LocalDate value) {
// Use simple YYYY-MM-DD
return value.toString();
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public ColumnView columnApply(int numRows, List<ColumnView> arguments) {
ColumnView dateView = arguments.get(0);
ColumnView daysView = arguments.get(1);
String[] result = new String[dateView.numRows()];
for (int i = 0; i < dateView.numRows(); i++) {
LocalDate date = LocalDate.parse(dateView.getString(i));
int days = (int)daysView.getDouble(i);
result[i] = date.plusDays(days).toString();
}
return new StringArrayColumnView(result);
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Override
public LocalDate toFieldValue(Object hrdValue) {
String stringValue = (String) hrdValue;
return LocalDate.parse(stringValue);
}
};
代码示例来源:origin: bedatadriven/activityinfo
@Override
public Date render(int rowIndex) {
assert view != null : "updateColumnSet() has not been called";
String text = view.getString(rowIndex);
if(text == null) {
return null;
}
return LocalDate.parse(text).atMidnightInMyTimezone();
}
代码示例来源:origin: bedatadriven/activityinfo
public static LocalDateInterval month(int year, int month) {
LocalDate start = new LocalDate(year, month, 1);
LocalDate end = LocalDate.getLastDateOfMonth(year, month);
return new LocalDateInterval(start, end);
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Test
public void dateEncoding() {
LocalDate start = new LocalDate(1999, 11, 15);
for (int i = 0; i < 400; i++) {
checkRoundTrip(start.plusDays(i));
}
}
内容来源于网络,如有侵权,请联系作者删除!