LoginSignup
1
0

More than 5 years have passed since last update.

【php】input type="date"の値を年・月・日に分割

Posted at

2018-01-112018 01 11 に分割。

$year = substr($this->request->get("today"), 0, 4);
$month = substr($this->request->get("today"), 5, 2);
$day = substr($this->request->get("today"), 8, 2);

頭のゼロを取りたいとき

DBに突っ込むときなどには先頭の0が邪魔なので取りたい。
一番簡単なのは文字列=>数値にすること。

$month = (int)$month;  //1
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0