當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.toString方法代碼示例

本文整理匯總了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);
}
 
開發者ID:fetox74,項目名稱:wormboard-backend,代碼行數:24,代碼來源:StatisticAggregatesController.java

示例2: encodeText

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public final String encodeText(final LocalDate value) {
  return value.toString();
}
 
開發者ID:traneio,項目名稱:ndbc,代碼行數:5,代碼來源:LocalDateEncoding.java

示例3: marshal

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public String marshal(LocalDate date)
{
    return date.toString();
}
 
開發者ID:a-schild,項目名稱:nextcloud-java-api,代碼行數:6,代碼來源:LocalDateXmlAdapter.java

示例4: marshal

import java.time.LocalDate; //導入方法依賴的package包/類
@Nullable
@Override
public String marshal(LocalDate v) {
	return v == null ? null : v.toString();
}
 
開發者ID:dvbern,項目名稱:date-helper,代碼行數:6,代碼來源:LocalDateXMLConverter.java

示例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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:7,代碼來源:TCKLocalDate.java

示例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);
}
 
開發者ID:ericywl,項目名稱:InfoSys-1D,代碼行數:6,代碼來源:BookingSlot.java

示例7: write

import java.time.LocalDate; //導入方法依賴的package包/類
@Override
public String write(LocalDate instant) throws Exception {
    return instant.toString();
}
 
開發者ID:adleritech,項目名稱:flexibee,代碼行數:5,代碼來源:LocalDateTransform.java

示例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;
}
 
開發者ID:hivdb,項目名稱:sierra,代碼行數:52,代碼來源:XmlOutput.java


注:本文中的java.time.LocalDate.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。