ee.Date.get

Stay organized with collections Save and categorize content based on your preferences.
Returns the specified unit of this date.

UsageReturns
Date.get(unit, timeZone)Long
ArgumentTypeDetails
this: dateDate
unitStringOne of 'year', 'month' (returns 1-12), 'week' (1-53), 'day' (1-31), 'hour' (0-23), 'minute' (0-59), or 'second' (0-59).
timeZoneString, default: nullThe time zone (e.g. 'America/Los_Angeles'); defaults to UTC.

Examples

Code Editor (JavaScript)

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

print('Year', date.get('year'));
print('Month', date.get('month'));
print('Week', date.get('week'));
print('Day', date.get('day'));
print('Hour', date.get('hour'));
print('Minute', date.get('minute'));
print('Second', date.get('second'));