Skip to content

Commit 6e3ce5f

Browse files
authored
Update date_timestamp_convert.md
1 parent 88075b2 commit 6e3ce5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

date_timestamp_convert.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Fri Dec 04 2020 16:55:33 GMT+0800 (中国标准时间)
1414
>
1515
> new Date().getTime();
1616
1607072122381
17-
> parseInt(new Date().getTime().toString() / 1000)
17+
> parseInt(new Date().getTime() / 1000)
1818
1607072254
1919
```
2020
@@ -51,6 +51,8 @@ $dateTime3 = date('Ymd', $time); // 20201204
5151
将基本时间转成时间戳:
5252
5353
```php
54+
// 获取时间戳
55+
$time = time();
5456
// 指定时间转成时间戳
5557
$timestamp1 = strtotime('2020-12-04 08:52:36');
5658
// 更加指定的英文描述获取时间戳
@@ -59,7 +61,7 @@ $timestamp3 = strtotime('-1 day'); // 获取一天前的时间戳
5961
$timestamp4 = strtotime('+2 weeks'); // 获取2周后的时间戳
6062
$timestamp5 = strtotime('-2 weeks'); // 获取2周前的时间戳
6163
$timestamp6 = strtotime('+3 months'); // 获取3个月后的时间戳
62-
$timestamp7 = strtotime('-3 months'); // 获取3个前的时间戳
64+
$timestamp7 = strtotime('-3 months'); // 获取3个月前的时间戳
6365
```
6466
6567
```

0 commit comments

Comments
 (0)