本文整理汇总了Java中java.time.LocalDate.toString方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.toString方法的具体用法?Java LocalDate.toString怎么用?Java LocalDate.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.LocalDate
的用法示例。
在下文中一共展示了LocalDate.toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getServerStatus
import java.time.LocalDate; //导入方法依赖的package包/类
@RequestMapping("/getServerStatus")
public ServerStatusBean getServerStatus()
{
String statusMsg;
List<Long> allDates = zwbAggregateCorpWorker.getAllDates();
Set<String> allMonth = allDates.stream()
.map(Object::toString)
.map(dateAsString -> dateAsString.substring(0, 6))
.collect(Collectors.toCollection(LinkedHashSet::new));
LocalDate firstProcessedDate = longToLocalDate(allDates.get(0));
LocalDate latestProcessedDate = longToLocalDate(allDates.get(allDates.size() - 1));
LocalDate today = LocalDate.now();
Long daysMissing = Stream.iterate(firstProcessedDate, date -> date.plusDays(1))
.limit(ChronoUnit.DAYS.between(firstProcessedDate, today) + 1)
.filter(date -> !allDates.contains(localDateToLong(date)))
.count();
statusMsg = "data until " + latestProcessedDate.toString() + ", " + daysMissing.toString() + (daysMissing == 1 ? " day" : " days") + " missing, ødb: " +
String.format("%.2f", responseTime.getDbMillis()) + " ms, øagg: " + String.format("%.2f", responseTime.getAggMillis()) + " ms";
return new ServerStatusBean(new ArrayList<>(allMonth), statusMsg);
}
示例2: encodeText
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public final String encodeText(final LocalDate value) {
return value.toString();
}
示例3: marshal
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public String marshal(LocalDate date)
{
return date.toString();
}
示例4: marshal
import java.time.LocalDate; //导入方法依赖的package包/类
@Nullable
@Override
public String marshal(LocalDate v) {
return v == null ? null : v.toString();
}
示例5: test_toString
import java.time.LocalDate; //导入方法依赖的package包/类
@Test(dataProvider="sampleToString")
public void test_toString(int y, int m, int d, String expected) {
LocalDate t = LocalDate.of(y, m, d);
String str = t.toString();
assertEquals(str, expected);
}
示例6: getDayWeekYear
import java.time.LocalDate; //导入方法依赖的package包/类
private String getDayWeekYear(LocalDate date) {
String dateString = date.toString();
String[] dateArr = dateString.split("-");
return dateArr[2] + "/" + dateArr[1] + "/" + dateArr[0].substring(2, 4);
}
示例7: write
import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public String write(LocalDate instant) throws Exception {
return instant.toString();
}
示例8: createRootElement
import java.time.LocalDate; //导入方法依赖的package包/类
private Element createRootElement() {
Element rootElement = document.createElement("DrugResistance_Interpretation");
rootElement.setAttributeNS(
"http://www.w3.org/2001/XMLSchema-instance",
"xsi:noNamespaceSchemaLocation",
"http://hivdb.stanford.edu/DR/schema/sierra.xsd");
// element name="algorithmName" type="xs:string"
rootElement.appendChild(
newSimpleElement("algorithmName", ALG_NAME));
// name="algorithmVersion" type="xs:string"
rootElement.appendChild(
newSimpleElement("algorithmVersion", ALG_VERSION));
// algorithmDate is not in schema
// rootElement.appendChild(
// newSimpleElement("algorithmDate", ALG_DATE));
// name="webServiceVersion" type="xs:string"
rootElement.appendChild(
newSimpleElement("webServiceVersion", WEB_SERVICE_VERSION));
// name="schemaVersion" type="xs:string"
rootElement.appendChild(
newSimpleElement("schemaVersion", SCHEMA_VERSION));
// name="submissionName" type="xs:string" minOccurs="0" maxOccurs="1"
rootElement.appendChild(
newSimpleElement("submissionName", SUBMISSION_NAME));
// name="dateTime" type="xs:string" minOccurs="0" maxOccurs="1"
LocalDate today = LocalDate.now();
LocalTime time = LocalTime.now();
String dateTime = today.toString() + " " + time.toString();
rootElement.appendChild(
newSimpleElement("dateTime", dateTime));
// name="result" type="Result" minOccurs="0" maxOccurs="unbounded"
for (int i=0; i < alignedSequences.size(); i ++) {
rootElement.appendChild(
createResultElement(
alignedSequences.get(i),
allResistanceResults.get(i)
)
);
}
return rootElement;
}