end date from week number in php
date('w'); //gets day of week as number(0=sunday,1=monday...,6=sat)
//note:returns 0 through 6 but as string so to check if monday do this:
if(date('w') == 1){
echo "its monday baby";
}Things to be aware of when using week numbers with years.
<?php
echo date("YW", strtotime("2011-01-07")); // gives 201101
echo date("YW", strtotime("2011-12-31")); // gives 201152
echo date("YW", strtotime("2011-01-01")); // gives 201152 too
?>
BUT
<?php
echo date("oW", strtotime("2011-01-07")); // gives 201101
echo date("oW", strtotime("2011-12-31")); // gives 201152
echo date("oW", strtotime("2011-01-01")); // gives 201052 (Year is different than previous example)
?>
Reason:
Y is year from the date
o is ISO-8601 year number
W is ISO-8601 week number of year
Conclusion:
if using 'W' for the week number use 'o' for the year.
Also in PHP:
- current date into time
- custom widget area wordpress
- add array to array php
- How to execute “php artisan migrate” and other Laravel commands in remote server?
- Arr::pull()
- base encode64 php
- dysplay message after form submit laravel
- codeigniter sms send
- How to see if there is a - in a string in php
- $this- attribute laravel
- Connecting that to Database using PHP.
- change native password in phpmyadmin
- $conn = new mysqli();
- Woocommerce Display field value on the admin order edit page [Custom Field Display 2]
- Count Number of days, months, years from DoB to till date php
- Which one from the following is true for creating laravel project
- command to create new laravel project
- find lenght string php
- command line how to create folder and file php
- array filter remove duplicates multidimensional php
- all uppercase in php
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". php 8
- display_errors php
- clear cache laravel in server