<?php
/**
* 一覧でよくあるNEWマークを出すかどうかの判定
*
* @param int $datetime
* @param int $range
* @return bool
*/
public function isNew($datetime, $range = 14/*2週間*/)
{
if (is_string($datetime)) {
$datetime = strtotime($datetime);
}
return (round((time() - $datetime) / (60 * 60 * 24)) <= $range);
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme