month year php code example

Example 1: get current month php

current month
  //half name in words
  date('M');
//full name in words
date('F');
//number
date('m');

Example 2: date in php

<?php
// prints something like: Wednesday the 15th
echo date('l \t\h\e jS');
?>
gmdate() - Format a GMT/UTC date/time
idate() - Format a local time/date as integer
getdate() - Get date/time information
getlastmod() - Gets time of last page modification
mktime() - Get Unix timestamp for a date
strftime() - Format a local time/date according to locale settings
time() - Return current Unix timestamp
DateTimeImmutable::__construct() - Returns new DateTimeImmutable object
Predefined DateTime Constants

Tags:

Php Example