Get
Funzione getter per le stringhe. Restituisce il valore corrispondente all'unità specificata, estratto dall'oggetto Day.js.
In generale:
js
dayjs().get(unit) === dayjs()[unit]();
Le unità non sono sensibili alla differenza tra maiuscole e minuscole e supportano forme plurali e abbreviate. Attenzione: le forme abbreviate sono sensibili alla differenza tra maiuscole e minuscole.
js
dayjs().get('year');
dayjs().get('month'); // parte da 0 (zero)
dayjs().get('date');
dayjs().get('hour');
dayjs().get('minute');
dayjs().get('second');
dayjs().get('millisecond');
Elenco delle unità disponibili
Unità | Abbreviazione | Descrizione |
---|---|---|
date | D | Giorno del mese |
day | d | Giorno della settimana (Domenica è 0, Sabato è 6) |
month | M | Mese (Gennaio è 0, Dicembre è 11) |
year | y | Anno |
hour | h | Ora |
minute | m | Minuto |
second | s | Secondo |
millisecond | ms | Millisecondi |