datetime get month php
$dateTime = new DateTime();
$month = $dateTime->format('m');// get day of month php
// Method 1; some server not work, I had check php 7.3.24 not worked, php 7.3.8 worked
cal_days_in_month(CAL_GREGORIAN, $month, $year)
echo (cal_days_in_month(CAL_GREGORIAN, 2, 2020)); // => 29
// Method 2;
function days_in_month($month, $year) {
// calculate number of days in a month
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
// Method 3;
echo (date('t', strtotime('2020-02-1'))); // 29
Also in PHP:
- check if page is front page in wordpress
- Tto upper php
- "data:text/vcard;
- check if date is within range php
- addslashes php
- db seeder laravel
- check array has key data
- convert day to timestamp php
- Argument 1 passed to Illuminate\Database\Grammar::parameterize()
- Allowed memory size of 536870912 bytes exhausted (tried to allocate 264245248 bytes) http://localhost:8000/createProduct
- delete cache manually laravel 5
- cache;clear laravel
- default seed installation laravel
- ctrl + d in vscode in phpstorm
- check the value type in php
- error enable php
- cannot use font awesome in php mvc
- check variable data type with value in php
- add errors php
- ext-dom ubuntu 20.04
- Cannot declare class Symfony\Component\Debug\ErrorHandler, because the name is already in use
- check php for errors
- PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp ecified key was too long; max key length is 1000 bytes")
- drupal 8 twig filters