Retrieving dates as day,month and year wise in PHP
by guruprasad[ Edit ] 2014-07-16 10:40:13
To Get the date from the current date as per day,month,year wise:
//current date in Y-M-D Format.
$now=date('Y-m-d');
// Retrieveing date from the current date by day wise .(For ex., retrieved 6 days before from current date).
$cal_day=date('Y-m-d',strtotime("-6 days"));
// Retrieveing date from the current date by month wise.(For ex., retrieved 1 month before from current date).
$cal_month=date('Y-m-d',strtotime("-1 month"));
// Retrieveing date from the current date by year wise.(For ex., retrieved 1 year before from current date).
$before_year=date('Y-m-d',strtotime("-1 year"));
Guna
thank you
0
1
Add Reply