How am I able to get the value of the previous year using PHP. Are there any predefined functions for it?
you can give a value of the input tag as : <? php echo date("Y-m-d",strtotime("-1 year"));?>
php $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'); $prev_date = date('Y-m-d', strtotime($date . ' -1 day')); echo $prev_date; ?>
$year = date('Y') - 1; // Get current year and subtract 1 $start = mktime(0, 0, 0, 1, 1, $year); $end = mktime(0, 0, 0, 12, 31, $year);
try
echo date("Y",strtotime("-1 year"));
$year = date("Y"); $previousyear = $year -1;
http://php.net/manual/de/function.date.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With