Yesterday php funkcija
Vienmēr aizmisrstās, kā atgriezt vakardienas datumu. Kad iegūglēju atradu šādu:
date("d-m-Y", strtotime("yesterday"));
Bet konvertēt tekstu par laiku man šķiet nepareizi, tāpēc uzrakstīju šādu funkciju:
function mydate($day=0)
{
$newtime = time() + $day * 86400; //(1 * 24 * 60 * 60) (dienas*st.*min.*sek.)
$date = date("Y-m-d", $newtime);
return $date;
}
Pēc noklusējuma atgriezīs šodienas datumu.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.