第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

“ PT”前綴在持續(xù)時(shí)間中代表什么?

“ PT”前綴在持續(xù)時(shí)間中代表什么?

達(dá)令說 2021-05-01 14:09:12
我正在嘗試使用Duration類而不是long。它具有出色的文字語法。我喜歡它的靈活性,盡管看起來很奇怪。“ PT10S”表示10秒,接受“ 10秒”有什么問題?好的沒關(guān)系。我很好奇為什么選擇了PT前綴(而不是“ DU”),為什么這里的前綴更好而不是沒有?
查看完整描述

3 回答

?
揚(yáng)帆大魚

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊

正如在Jesper所鏈接到的頁面上可以找到的(ISO-8601-數(shù)據(jù)元素和交換格式–信息交換–日期和時(shí)間的表示

P is the duration designator (for period) placed at the start of the duration representation.
Y is the year designator that follows the value for the number of years.
M is the month designator that follows the value for the number of months.
W is the week designator that follows the value for the number of weeks.
D is the day designator that follows the value for the number of days.
T is the time designator that precedes the time components of the representation.

所以P的意思是'Period',因?yàn)闆]有日期成分,所以它只有一個(gè)'Time'。

您可以將其解釋為“時(shí)間段”

選擇“為什么”的原因是,您必須詢問編寫該標(biāo)準(zhǔn)的ISO成員,但我猜想它很容易解析。(簡(jiǎn)短明確)


查看完整回答
反對(duì) 回復(fù) 2021-05-12
?
Smart貓小萌

TA貢獻(xiàn)1911條經(jīng)驗(yàn) 獲得超7個(gè)贊

Java在一段時(shí)間內(nèi)采用了ISO 8601標(biāo)準(zhǔn)格式的子集。因此,“為什么”是按原樣編寫標(biāo)準(zhǔn)的原因,這是一個(gè)猜謎游戲。我去:

  • P選擇了“期間”,以便您可以將持續(xù)時(shí)間與日期和/或時(shí)間區(qū)分開。特別是因?yàn)橐部梢杂门c本地日期時(shí)間相同的格式來寫時(shí)間段,例如P0003-06-04T12:30:053年6個(gè)月4天12小時(shí)30分鐘5秒,所以P可能需要區(qū)分。該P還提供了一點(diǎn)點(diǎn),但如果你碰巧經(jīng)過一個(gè)完全不同的字符串在持續(xù)時(shí)間預(yù)期的地方驗(yàn)證快速,便捷位。是的,PT10S看起來很奇怪,但是一旦您習(xí)慣了它,就可以立即將其識(shí)別為持續(xù)時(shí)間,這很實(shí)用。

  • T 選擇日期部分和時(shí)間部分之間的時(shí)間有兩個(gè)原因:

    • 為了與T位于同一位置的日期時(shí)間字符串保持一致,例如2018-07-04T15:002018年7月4日15:00時(shí)。

    • M幾個(gè)月或幾分鐘內(nèi)消除本來就模棱兩可的內(nèi)容:P3M明確表示3個(gè)月,而PT3M表示3分鐘。


查看完整回答
反對(duì) 回復(fù) 2021-05-12
?
慕娘9325324

TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊

Actually if go on Duration API developed in Java @since 1.8 , they have gone with standard ISO 8601


with java doc as below  :


/**

 * Applies an ISO 8601 Duration to a {@link ZonedDateTime}.

 *

 * <p>Since the JDK defined different types for the different parts of a Duration

 * specification, this utility method is needed when a full Duration is to be applied to a

 * {@link ZonedDateTime}. See {@link Period} and {@link Duration}.

 *

 * <p>All date-based parts of a Duration specification (Year, Month, Day or Week) are parsed

 * using {@link Period#parse(CharSequence)} and added to the time. The remaining parts (Hour,

 * Minute, Second) are parsed using {@link Duration#parse(CharSequence)} and added to the time.

 *

 * @param time   A zoned date time to apply the offset to

 * @param offset The offset in ISO 8601 Duration format

 * @return A zoned date time with the offset applied

 */

public static ZonedDateTime addOffset(ZonedDateTime time, String offset) { }


Obtains a Duration from a text string of pattern: PnDTnHnMn.nS, where

nD = number of days,

nH = number of hours,

nM = number of minutes,

n.nS = number of seconds, the decimal point may be either a dot or a comma.

T = must be used before the part consisting of nH, nM, n.nS



Example of implementation with java as 


import java.time.Duration;


public class ParseExample {


    public static void main(String... args) {

        parse("PT20S");//T must be at the beginning to time part

        parse("P2D");//2 day

        parse("-P2D");//minus 2 days

        parse("P-2DT-20S");//S for seconds

        parse("PT20H");//H for hours

        parse("PT220H");

        parse("PT20M");//M for minutes

        parse("PT20.3S");//second can be in fraction like 20.3

        parse("P4DT12H20M20.3S");

        parse("P-4DT-12H-20M-20.3S");

        parse("-P4DT12H20M20.3S");

    }


    private static void parse(String pattern) {

        Duration d = Duration.parse(pattern);

        System.out.println("Pattern: %s => %s%n", pattern, d);

    }

}


查看完整回答
反對(duì) 回復(fù) 2021-05-12
  • 3 回答
  • 0 關(guān)注
  • 1236 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)