반응형
php
$date1 = date_create("2023-02-01");
$date2 = date_create("2023-03-01");
$date3 = date_diff($date1, $date2);
echo $date3->format('%a');
javascript
var date1 = new Date("2023-02-01");
var date2 = new Date("2023-03-01");
var date3 = date1.getTime() - date2.getTime();
console.log(Math.abs(date3 / (1000 * 60 * 60 * 24)));
반응형