正在顯示「 2025 年 3 月 」的所有結果
3月 16, 2025 Javascript
### 長話短說

先去 Code 睇一睇先:

```js
// 取得現在月份的第1日
const startOfMonth = moment().startOf('month').format('YYYY-MM-DD hh:mm:ss');

// 取得現在月份的最後一日
const endOfMonth = moment().endOf('month').format('YYYY-MM-DD hh:mm:ss');
```

### Regexp check timezone string

可以用以下的 regex 來檢查傳入的 string 是否為 timezone 時間字串。

只用於檢查基本的 format,不會細緻檢查內容問題。

```js
// 用來 check 基本時間 + timezone 資料
const regex = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(|\\.[0-9]+)(Z|[\\+\\-][0-9]{2}:[0-9]{2})$/;
```
過去文章
2025 (9)
4 (5)
3 (1)
2 (3)
2024 (25)
11 (3)
10 (3)
9 (1)
3 (18)
2022 (6)
10 (1)
6 (2)
5 (1)
3 (1)
1 (1)
2021 (21)
11 (7)
7 (1)
6 (2)
5 (2)
4 (6)
3 (2)
2 (1)
2020 (92)
12 (1)
11 (2)
10 (4)
9 (10)
8 (5)
7 (1)
6 (3)
5 (1)
4 (4)
3 (25)
2 (7)
1 (29)
2019 (57)
12 (25)
11 (7)
9 (25)