הודעה : כל הפרויקטים הלא מסחריים שנרשמו לשימוש ב-Earth Engine לפני
15 באפריל 2025 חייבים
לאמת את הזכאות לשימוש לא מסחרי כדי לשמור על הגישה. אם לא תאמתו את החשבון עד 26 בספטמבר 2025, יכול להיות שהגישה שלכם תושעה.
שליחת משוב
ee.Date.getRelative
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מחזירה את היחידה שצוינה (מבוססת-0) של התאריך הזה ביחס ליחידה גדולה יותר. לדוגמה, getRelative('day', 'year') מחזירה ערך בין 0 ל-365.
שימוש החזרות Date. getRelative (unit, inUnit, timeZone )
ארוך
ארגומנט סוג פרטים זה: date
תאריך unit
מחרוזת אחת מהאפשרויות הבאות: 'חודש', 'שבוע', 'יום', 'שעה', 'דקה' או 'שנייה'. inUnit
מחרוזת אחת מהאפשרויות הבאות: 'שנה', 'חודש', 'שבוע', 'יום', 'שעה' או 'דקה'. timeZone
מחרוזת, ברירת המחדל: null אזור הזמן (למשל, 'America/Los_Angeles'); ברירת המחדל היא UTC.
דוגמאות
Code Editor (JavaScript)
var date = ee . Date ( '2021-4-30T07:15:31.24' );
print ( '0-based month of year' , date . getRelative ( 'month' , 'year' ));
print ( '0-based week of year' , date . getRelative ( 'week' , 'year' ));
print ( '0-based day of year' , date . getRelative ( 'day' , 'year' ));
print ( '0-based day of month' , date . getRelative ( 'day' , 'month' ));
print ( '0-based minute of day' , date . getRelative ( 'minute' , 'day' ));
print ( '0-based second of minute' , date . getRelative ( 'second' , 'minute' ));
// 0 is returned when unit argument is larger than inUnit argument.
print ( '0-based year of month (bad form)' , date . getRelative ( 'year' , 'month' ));
הגדרת Python
בדף
סביבת Python מפורט מידע על Python API ועל השימוש ב-geemap
לפיתוח אינטראקטיבי.
import ee
import geemap.core as geemap
Colab (Python)
date = ee . Date ( '2021-4-30T07:15:31.24' )
display ( '0-based month of year:' , date . getRelative ( 'month' , 'year' ))
display ( '0-based week of year:' , date . getRelative ( 'week' , 'year' ))
display ( '0-based day of year:' , date . getRelative ( 'day' , 'year' ))
display ( '0-based day of month:' , date . getRelative ( 'day' , 'month' ))
display ( '0-based minute of day:' , date . getRelative ( 'minute' , 'day' ))
display ( '0-based second of minute:' , date . getRelative ( 'second' , 'minute' ))
# 0 is returned when unit argument is larger than inUnit argument.
display ( '0-based year of month (bad form):' , date . getRelative ( 'year' , 'month' ))
שליחת משוב
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0 . לפרטים, ניתן לעיין במדיניות האתר Google Developers . Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
רוצה לתת לנו משוב?
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-25 (שעון UTC)."],[],[]]