I want to get the year in 2 digits, for example 15 .
using php date () function
echo date("Y");
but it returns all year.
any help is ambiguous. Thanks!
Change uppercase "Y" to lowercase "y"
echo date("y");
PHP documentation
y A two digit representation of a year
http://php.net/manual/en/function.date.php
See this documentation. This is date("y") . So, lowercase y instead of Y.
date("y")
You can use the PHP substr () method to get the last two digits of the year as follows.
$year = 2011; $year = substr( $year, -2);
The code above gives 11 as the result, which is the last two-digit digit of 2011.
Source: https://habr.com/ru/post/1213643/More articles:UNIX domain partitioning not closed after closing () - cGet the number of records matching the CloudKit query. - iosClearing an xdt element if it has no children - c #perl get list of desired parameters - perlWhy is this hash, created from a permanent list, "in a different order" every time the program starts? - perlJava 8 threads adding values ββfrom two or more lists - javaHow to use python variable in javascript? - javascriptHow is a static class implicitly abstract? - c #Move one Git repository to a subfolder of another with branches - gitRestAngular Best Practice - angularjsAll Articles