/ Published in: PHP
These are some date functions.
Get Current Week Start Date
Get Current Week End Date
Get Current Month Start
Get Current Month End
Get Current Year Start
Get Current Year End
and these functions can help you getting last week's start date or next month end date.
To get last week's start date, remove 7 days from current week, and pass that date to get current week start date and it will return last week's start date.
Get Current Week Start Date
Get Current Week End Date
Get Current Month Start
Get Current Month End
Get Current Year Start
Get Current Year End
and these functions can help you getting last week's start date or next month end date.
To get last week's start date, remove 7 days from current week, and pass that date to get current week start date and it will return last week's start date.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function week_start_date($wk_num, $yr, $first = 1, $format = 'l, d-M-y') { } function date_get_week_start($date, $date_format = "Y-m-d") { /* * Week Start from Monday */ $date = week_start_date($week, $year, 1, $date_format); return $date; } function date_get_week_end($date, $date_format = "Y-m-d") { /* * Week Ends on Sunday */ $date = week_start_date($week, $year, 7, $date_format); return $date; } function date_get_month_start($date, $date_format = "Y-m-d") { $date = $year."-".$month."-"."01"; } function date_get_month_end($date, $date_format = "Y-m-d") { } function date_get_year_start($date, $date_format = "Y-m-d") { $date = $year."-01-01"; } function date_get_year_end($date, $date_format = "Y-m-d") { $date = $year."-12-31"; }