Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
php 的日期操作
<?php
// 这两者是等效的
$yesterday = date('Y-m-d', time() - 86400);
$yesterday = date('Y-m-d', strototime('-1 day'));
// 上个月第一天
$date = date('Y-m-d', strtotime('first day of last month'));
// 上个月最后一天
$date = date('Y-m-d', strtotime('last day of last month'));
// 以此类推
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.