Child pages
  • PHP Carbon 라이브러리로 날짜/시간 처리하기

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var_dump(Carbon::YEARS_PER_CENTURY);               // int(100)
var_dump(Carbon::YEARS_PER_DECADE);                // int(10)
var_dump(Carbon::MONTHS_PER_YEAR);                 // int(12)
var_dump(Carbon::WEEKS_PER_YEAR);                  // int(52)
var_dump(Carbon::DAYS_PER_WEEK);                   // int(7)
var_dump(Carbon::HOURS_PER_DAY);                   // int(24)
var_dump(Carbon::MINUTES_PER_HOUR);                // int(60)
var_dump(Carbon::SECONDS_PER_MINUTE);              // int(60)


CarbonInterval

PHP 의 dateinterval 을 상속한 유틸리티 클래스


make() 메서드로 문자열로부터 Instance 생성 가능

Code Block
echo CarbonInterval::make('1h 15m')->forHumans();            // 1 hour 15 minutes


같이 보기