> For the complete documentation index, see [llms.txt](https://documentation.soulver.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.soulver.app/zh/yu-fa-can-kao/dates/dates-and-times.md).

# 日历计算

### 从日期增加或减去时间

```
10 June + 3 weeks                     | 1 July
April 1, 2019 − 3 months 5 days       | 27 December 2018

12/02/1988 + 32 years                 | 12 February 2020
01.05.2005 + 3 years 2 months 3 weeks | 22 July 2008

3 weeks after March 14, 2019          | 4 April 2019
28 days before March 12               | 12 February
2 months 3 days after June 5          | 8 August

yesterday - 8 weeks 3 days            | 12 July
Yesterday + 1 week                    | 11 June
```

### 获取相对于当前日期的日期

```
today + 3 weeks | 1 October
now − 1 month   | 5 May

4 days from now | 14 September
3 days ago      | 7 September
```

### **查找两个日期之间的时间量**

```
January 10 - February 5         | 3 weeks 5 days

3 March to 30 May               | 2 months 3 weeks 6 days

days since July 15              | 57 days
days till December 25           | 106 days
days between 3 March and 30 May | 88 days

1978 to 2021                    | 42 years

```

{% hint style="info" %}
时间间隔是从第一个日期的中午到最后一个日期的中午计算的。

如果您想将起始和结束日期都包含在间隔内，请使用包含间隔函数（参见 [下面](#inclusive-intervals-of-time-1)）
{% endhint %}

### 两个日期之间的包含时间间隔 <a href="#inclusive-intervals-of-time" id="inclusive-intervals-of-time"></a>

```
April 1 through April 30 in days | 30 days
```

### 周数（ISO 8601）

```
week of year                  | 36
week number on march 12, 2021 | 10
```

### **一个月或一个季度有多少天**

```
days in Q3            | 92 days
days in February 2020 | 29 days
```

### 查找两个日期之间的中点

```
midpoint between March 12 and April 5   | 24 March
halfway between today and next Thursday | 13 September
```

## 关于日历计算歧义性的说明

**模糊的月份**

与天和周不同，月份在秒的定义上并不明确。Soulver 会根据表达式尝试执行最合乎逻辑的操作。它很擅长考虑到闰年和其他日历的特殊情况：

```
Feb 28 + 1 month          | 28 March
January 31 2020 + 1 month | February 29 2020
```

**未指定年份的日期**

没有指定年份的日期可能会使用当前年份或下一年。

```
# In December 2019

// 假设下一年，因为最近的一月在未来
January 12 + 3 weeks | 2 February 2020

// 假设今年，因为月份仍然在近期过去
November 1 - 5 days  | 27 October 2019
```
