some date formatting just day just month just year

Useful if you need to get PHP to return parts of the date.

The date today in number format

$date_today = date("d"); 

e.g: 21

Todays month name

$month_name = date("F"); 

e.g: July

Current Year as a number

$year = date("Y"); 

e.g: 2017

you can also get a specific day using the date function, to get yesterdays date you can do the following:

date('d F Y',strtotime("-1 days"));

this should output yesterdays date, e.g: 20 July 2017

Demo

Other Items in php
Page Views

This page has been viewed 58 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹