Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get date to current week last or first day dates


function getWeekDates($date)
{
    $week =  date('W', strtotime($date));
    $year =  date('Y', strtotime($date));
    $from = date("Y-m-d", strtotime("{$year}-W{$week}-1")); //Returns the date of monday in week
    $to = date("Y-m-d", strtotime("{$year}-W{$week}-7"));   //Returns the date of sunday in week
    
    $returnArray = array();
    $returnArray['start_date'] = $from;
    $returnArray['end_date'] = $to;
    return $returnArray;
    //echo "Start Date-->".$from."End Date -->".$to;//Output : Start Date-->2012-09-03 End Date-->2012-09-09
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel inline if else if 
Php :: laravel hash 
Php :: get field object acf 
Php :: php count days excluding weekends 
Php :: orwhere in wherehas laravel 
Php :: php implode associative array 
Php :: php prepared statement upload file 
Php :: php while jump to next loop 
Php :: php combine 2 arrays keep duplicates 
Php :: how to save data from api to laravel 
Php :: laravel validation required if 
Php :: laravel redis cache 
Php :: How do you set a variable to an integer? in php 
Php :: set_magic_quotes_runtime php 7 
Php :: how create page 419 in laravel 
Php :: json_encode php 
Php :: laravel tinker insert db record 
Php :: insert into database with seeder 
Php :: Download any version of xampp 
Php :: woocommerce update_status 
Php :: wordpress options 
Php :: constants in php 
Php :: preg_split in php 
Php :: how to fetch the sum of column in php mysql 
Php :: in arrray php 
Php :: laravel get namespace 
Php :: Drupal 8 custom form image field 
Php :: wordpress change slug programmatically 
Php :: PHP - AJAX and PHP 
Php :: php str starts with 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =