0
나는 다음과 같은 코드가 있습니다탄소 시간대 기능이 잘못
이// $this->date_from = '11/01/2017';
// $this->date_to = '11/30/2017';
$this->where_date_from = Carbon::parse($this->date_from)->tz('America/Toronto')->startOfDay()->timestamp;
$this->where_date_to = Carbon::parse($this->date_to)->tz('America/Toronto')->endOfDay()->timestamp;
이 완전히 innacturate 타임 스탬프를 생성합니다. 그것은 실제로 UTC에서 오프셋의 두 배를 뺀 것으로 보입니다.
그러나, 나는 다음 사용할 때 :
date_default_timezone_set('America/Toronto');
$this->where_date_from = strtotime($this->date_from.' 00:00:00');
$this->where_date_to = strtotime($this->date_to.' 23:59:59');
그것은 완벽하게 작동합니다.
왜 이런 일이 발생합니까? 탄소를 사용하여 이것을 달성하고 싶습니다. 따라서 date_default_timezone_set
으로 뒤죽박죽을 쓸 필요가 없습니다.