Q:

OUTPUT a DATE and Time from database TIMESTAMP PHP

How can i convert the timestamp in database table row to 9:00AM or PM 
say i have a row value from database 2016-10-14 15:08:06
the Output must be 2016-10-14 03:08 AM or PM using php
2016-10-14 03:08 AM

A:

for example we have time stamp at below variable 
$t="1512314221";

use Date function to convert it to date time format :
echo Date("Y-m-d H:i:s",$t); //output 2017-03-13 15:17:01

also you can append these strings to date format :

F    A full textual representation of a month, such as January or March  
m    Numeric representation of a month, with leading zeros   01 through 12
M    A short textual representation of a month, three letters    Jan
through Dec
l (lowercase 'L')    A full textual representation of the day of the
week Sunday through Saturday
D    A textual representation of a day, three letters    Mon through Sun
g    12-hour format of an hour without leading zeros 1 through 12
G    24-hour format of an hour without leading zeros 0 through 23
h    12-hour format of an hour with leading zeros    01 through 12

