Given a Unix timestamp, how to get beginning and end of that day?

strtotime can be used to to quickly chop off the hour/minutes/seconds $beginOfDay = strtotime(“today”, $timestamp); $endOfDay = strtotime(“tomorrow”, $beginOfDay) – 1; DateTime can also be used, though requires a few extra steps to get from a long timestamp $dtNow = new DateTime(); // Set a non-default timezone if needed $dtNow->setTimezone(new DateTimeZone(‘Pacific/Chatham’)); $dtNow->setTimestamp($timestamp); $beginOfDay = clone … Read more

PHP, Get tomorrows date from date

Use DateTime $datetime = new DateTime(‘tomorrow’); echo $datetime->format(‘Y-m-d H:i:s’); Or: $datetime = new DateTime(‘2013-01-22’); $datetime->modify(‘+1 day’); echo $datetime->format(‘Y-m-d H:i:s’); Or: $datetime = new DateTime(‘2013-01-22’); $datetime->add(new DateInterval(“P1D”)); echo $datetime->format(‘Y-m-d H:i:s’); Or in PHP 5.4+: echo (new DateTime(‘2013-01-22’))->add(new DateInterval(“P1D”)) ->format(‘Y-m-d H:i:s’);

$date + 1 year?

$futureDate=date(‘Y-m-d’, strtotime(‘+1 year’)); $futureDate is one year from now! $futureDate=date(‘Y-m-d’, strtotime(‘+1 year’, strtotime($startDate)) ); $futureDate is one year from $startDate!

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)