Skip to content

Q18. [個人技能題組][Backend] 基礎: 時區 #25

@Leeboyd

Description

@Leeboyd

時間格式是新手入坑肯定會摔跤的地方,試著回答下列問題。

  1. UTC 是什麼?能表示時區嗎?
  2. Timestamp 是什麼?能表示時區嗎?
  3. DB 能不能設定時區 (以 mysql 為例)
  4. 程式能不能設定時區 (以 nodejs 為例)
  5. 系統能不能設定時區 (以 linux 為例)
  6. DB 內的日期時間欄位若存 string 和存 timestamp 和存 datetime 有什麼差別
  7. Mysql 欄位格式 timestamp 和 datetime 的差別是什麼
  8. 請問分別在伺服器上用 UTC 跟用本地時區的好處跟壞處在哪?
  9. 系統(伺服器)的時區設定是否會影響 DB 中的資料?
  10. (限mysql/mariadb)今天在 DB 中新增一個欄位,當時欄位型別是寫 boolean,但實際上開起來根本不是 boolean。這中間發生了什麼事情?
  11. 承上,實際上開的型別跟 boolean 是什麼關係?

@tnstiger 建議這麼做:
不弄懂這些問題,那你就會像隻跑回圈的老鼠,永遠都搞不清楚要怎麼用

  • 在一個 table 放一個 timestamp 的欄位
  • 然後 INSERT INTO test VALUES (‘2017-04-05 18:19:03')
  • 看看他的 value 是什麼

答題時間: ? hr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions