本文整理匯總了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;
}