PHP date and time, PHP date and time. PHP date and time, PHP date and time 1, datestringdate (string $ format [, int $ timestamp]) echodate (Y ). br; 2016 echodate (y ). br; 16echo ------ br; echo PHP date and time, PHP date and time
1. date
string date ( string $format [, int $timestamp ] )
Echo date ('Y ').'
'; // 2016
Echo date ('Y ').'
'; // 16
Echo '------
';
Echo date ('M ').'
'; // 03
Echo date ('M ').'
'; // Mar. uppercase M indicates the three abbreviations of the month.
Echo date ('N ').'
'; // 3,
Echo date ('F ').'
'; // March. all the English letters of the month
Echo '------
';
Echo date ('D ').'
'; // 09
Echo date ('J ').'
'; // 9
Echo date ('s ').'
'; // Th, indicating the suffix of the date.
Echo '------
';
Echo date ('g ').'
'; // 4, 12-hour format, with no 0 in front
Echo date ('g ').'
'; // 16, in 24-hour format, with leading 0
Echo date ('h ').'
'; // 16, 24 hour format, with no 0 in front
Echo date ('h ').'
'; // 01, in 12-hour format, with leading 0
Echo '------
';
Echo date ('I ').'
'; // 42, minutes
Echo '------
';
Echo date ('s ').'
'; // 26, seconds
Echo date ('s ').'
'; // Th, indicating the suffix of the date.
Echo '------
';
Echo date ('A ').'
'; // Pm, lowercase am (morning) pm (afternoon)
Echo date ('A ').'
'; // PM, uppercase
Echo '------
';
Echo date ('L ').'
'; // Thursday. the day is the day of the week in full (Tuesday)
Echo date ('L ').'
'; // 1. if it is a leap year, 1 is returned. otherwise, 0 is returned.
Echo date ('D ').'
'; // Thu, the abbreviation of the day of the week (Tue)
2. mktime ()
Mktime generates a timestamp for the specified time. prototype:
int mktime ([ int $hour = date("H") [, int $minute = date("i") [, int $second = date("s") [,int $month = date("n") [, int $day = date("j") [, int $year = date("Y") [, int $is_dst = -1]]]]]]] )
$ Tomorrow = mktime (0, 0, 0, date ("m"), date ("d") + 1, date ("Y "));
Echo "tomorrow is". date ("Y/m/d", $ tomorrow );
3. strtotime ()
$ D = strtotime ("pm else L 15 2015 ");
Echo "creation date is". date ("Y-m-d h: I: sa", $ d );
$ D = strtotime ("tomorrow ");
Echo date ("Y-m-d h: I: sa", $ d )."
";
$ D = strtotime ("next Saturday ");
Echo date ("Y-m-d h: I: sa", $ d )."
";
$ D = strtotime ("+ 3 Months ");
Echo date ("Y-m-d h: I: sa", $ d )."
";
Values 1, date string date (string $ format [, int $ timestamp]) echo date ('Y '). 'Br/'; // 2016 echo date ('Y '). 'Br/'; // 16 echo' ------ br/'; echo...