date year php
<?php
// To change the format of an existing date
$old_date_format = "20/03/1999";
$new_data_format = date("Y-m-d H:i:s", strtotime($old_date_format));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.
check here link: http://www.eltcalendar.com/stuff/datemysqlphp.html
Also in PHP:
- eloquent update row response
- array reverser ph
- drop column migration laravel
- add one day in php
- array push foreach php
- Laravel DB facade relations
- Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.2.33.
- "Fatal error: Allowed memory size of 1610612736 bytes exhausted " +laravel
- create random string in php
- datetformat php
- check if array key exists in array php
- convert date and time to time stamp phph
- download html content from url php
- change datetime format from Y-m-d h:i:s to d-m-Y in php
- 500 server error laravel handle
- extend woocommerce user fields edit-account
- client_ip() function php
- /phpspreadsheet 1.15.0 requires ext-dom * centos
- download php 7.4 ubuntu
- How to see if there is a - in a string in php
- date and time function php
- date('N') php
- array remove duplicate values php
- Class 'Pusher' not found