Answers for "get date of last 7 day"

PHP
0

get date of last 7 day

<?php
// Your code here!
date_default_timezone_set('Asia/Kolkata');

$start_date = date("Y-m-d 00:00:01");
var_dump($start_date);
$end_date = date("Y-m-d 23:59:59");
var_dump($end_date);


$yesterday_start_date=date('Y-m-d 00:00:01',(strtotime ( '-1 day' , strtotime (date("Y-m-d 00:00:01")) ) ));
var_dump($yesterday_start_date);

$yesterday_end_date=date('Y-m-d 23:59:59',(strtotime ( '-1 day' , strtotime (date("Y-m-d 00:00:01")) ) ));
var_dump($yesterday_end_date);

$seven_start_date=date('Y-m-d 00:00:01',(strtotime ( '-7 day' , strtotime (date("Y-m-d 00:00:01")) ) ));
var_dump($seven_start_date);

$seven_start_date=date("Y-m-d 23:59:59");
var_dump($seven_start_date);

$monthly_start_date=date('Y-m-d 00:00:01',(strtotime ( '-30 day' , strtotime (date("Y-m-d 00:00:01")) ) ));
var_dump($monthly_start_date);

$monthly_end_date=date("Y-m-d 23:59:59");
var_dump($monthly_end_date);

$yearly_start_date=date('Y-m-d 00:00:01',(strtotime ( '-365 day' , strtotime (date("Y-m-d 00:00:01")) ) ));
var_dump($yearly_start_date);

$yearly_end_date=date("Y-m-d 23:59:59");
var_dump($yearly_end_date);
?>
Posted by: Guest on September-11-2021

Code answers related to "get date of last 7 day"

Browse Popular Code Answers by Language