day of the week th usig 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:
- apache php e_warnings e_notice off
- clear cache laravel and composer
- am pm time php
- clear docker cache
- 7 reasons why Lee is an idiot
- define header in php
- Database name seems incorrect You're using the default database name laravel. This database does not exist. Edit the .env file and use the correct database name in the DB_DATABASE key.
- control string length php
- check if a word is present inside a string in php
- count length of string pphp
- enable all errors php
- clear laravel component cache
- php check if string contains
- desired date in pgp
- create random unique string
- base64 encode and decode in php
- eloquent all only one culomn
- executar comando linux php
- SET CURRENT DATE TIME IN PHP'
- express get current url
- create seede for table in laravel
- create database backup programmatically php
- array should not be empty php
- array shift php