---
# System prepended metadata

title: Google App Script 日期
tags: [Google App Script]

---

Google App Script 日期
===
Google 表單的「日期」型態
---
###### tags: `Google App Script`
---
2019-10-18

但Google App Script只能接受「2019/10/18」
轉換
```javascript=
time = new Date(time.replace(/-/g, "/"));
```


Google App Script 日期
---
```javascript=

  var time ="2019-10-18 09:30";
  Logger.log(time);
  Logger.log(new Date(time));
  Logger.log(new Date(time.replace(/-/g, "/")));


[19-10-18 09:09:24:677 HKT] 2019-10-18 09:30
[19-10-18 09:09:24:678 HKT] Thu Jan 01 08:00:00 GMT+08:00 1970
[19-10-18 09:09:24:679 HKT] Fri Oct 18 09:30:00 GMT+08:00 2019
```


Javascript 日期
---
```
console.log(new Date("2019/10/18 09:30"))
VM312:1 Fri Oct 18 2019 09:30:00 GMT+0800 (台北標準時間)

console.log(new Date("2019-10-18 09:30"))
VM318:1 Fri Oct 18 2019 09:30:00 GMT+0800 (台北標準時間)

```