Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLongDuration ¶
AddLongDuration parses time duration from `duration` argument and adds to time in `now`, returning the resulting time. The duration format is similar to `time` package duration format, with the following changes: - additional duration units are supported:
- 'D' for days,
- 'M' for months,
- 'Y' for years,
- fractional numbers are *not* supported,
- negative numbers are *not* supported,
- whitespace at the beginning and end of duration string is ignored,
- optionally there can be one whitespace character between the number and unit.
Long durations are handled using Time.AddDate function, which works by adding given number of years, months, and days to tval. It normalizes its result, for example, adding one month to October 31 yields December 1, the normalized form for November 31.
Examples:
`AddLongDuration(time.Now(), "1000 Y")` `AddLongDuration(time.Now(), "7 D")` `AddLongDuration(then, "1 M")`
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.