ee.Date.getFraction

تعرض هذه الدالة الكسر المنقضي لهذا التاريخ من الوحدة المحدّدة (بين 0 و1).

الاستخدامالمرتجعات
Date.getFraction(unit, timeZone)عدد عائم
الوسيطةالنوعالتفاصيل
هذا: dateالتاريخ
unitسلسلةتكون إمّا "عام" أو "شهر" أو "أسبوع" أو "يوم" أو "ساعة" أو "دقيقة" أو "ثانية".
timeZoneسلسلة، القيمة التلقائية: فارغةالمنطقة الزمنية (مثل 'America/Los_Angeles')؛ يتم ضبطه تلقائيًا على التوقيت العالمي المنسَّق.

أمثلة

محرِّر الرموز البرمجية (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'));

إعداد Python

اطّلِع على صفحة بيئة Python للحصول على معلومات عن واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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'))