ee.Date.getFraction

Zwraca upływ czasu w podanej jednostce (od 0 do 1).

WykorzystanieZwroty
Date.getFraction(unit, timeZone)Liczba zmiennoprzecinkowa
ArgumentTypSzczegóły
to: dateData
unitCiąg znakówJedna z wartości „year” (rok), „month” (miesiąc), „week” (tydzień), „day” (dzień), „hour” (godzina), „minute” (minut) lub „second” (sekunda).
timeZoneCiąg tekstowy, domyślnie: nullStrefa czasowa (np. 'America/Los_Angeles'); domyślnie ustawiona jest strefa czasowa UTC.

Przykłady

Edytor kodu (JavaScript)

var date = ee.Date('2021-4-30T07:15:31.24');

print('Elapsed fraction of a year', date.getFraction('year'));
print('Elapsed fraction of a month', date.getFraction('month'));
print('Elapsed fraction of a week', date.getFraction('week'));
print('Elapsed fraction of a day', date.getFraction('day'));
print('Elapsed fraction of an hour', date.getFraction('hour'));
print('Elapsed fraction of a minute', date.getFraction('minute'));
print('Elapsed fraction of a second', date.getFraction('second'));

Konfiguracja Pythona

Informacje o interfejsie Python API i o używaniu pakietu geemap do programowania interaktywnego znajdziesz na stronie Python Environment.

import ee
import geemap.core as geemap

Colab (Python)

date = ee.Date('2021-4-30T07:15:31.24')

display('Elapsed fraction of a year:', date.getFraction('year'))
display('Elapsed fraction of a month:', date.getFraction('month'))
display('Elapsed fraction of a week:', date.getFraction('week'))
display('Elapsed fraction of a day:', date.getFraction('day'))
display('Elapsed fraction of an hour:', date.getFraction('hour'))
display('Elapsed fraction of a minute:', date.getFraction('minute'))
display('Elapsed fraction of a second:', date.getFraction('second'))