Returns the specified (0-based) unit of this date relative to a larger unit, e.g. getRelative('day', 'year') returns a value between 0 and 365.
Usage | Returns |
---|---|
Date.getRelative(unit, inUnit, timeZone) | Long |
Argument | Type | Details |
---|---|---|
this: date | Date | |
unit | String | One of 'month' 'week', 'day', 'hour', 'minute', or 'second'. |
inUnit | String | One of 'year', 'month' 'week', 'day', 'hour', or 'minute'. |
timeZone | String, default: null | The time zone (e.g. 'America/Los_Angeles'); defaults to UTC. |
Examples
JavaScript
// Your example goes here!
Python
# Your example goes here!