Convert from unix time stamp to date time format

FROM_UNIXTIME(Table field name, ‘%Y-%m-%d’)

This funtionĀ  convert unix time stamp to date time format.

for example :

FROM_UNIXTIME(Created, ‘%Y-%m-%d’)

Advertisements

Find date and month

find any previous month
echo date(“Y-m”, strtotime(“-13 months”));
2014-08

find any previous month
echo date(“Y-m”, strtotime(“-1 months”));
2015-08

find last month
echo date(‘m’, strtotime(‘last month’));
08

last date of any month
$a = strtotime(‘2012-2-1’);
echo date(‘t’, $a);
29