Select custom date format from table where store created field in UnixTimeStamp data


//created field int(11) type in table : NewTB
$sql = mysql_query(“select  *, FROM_UNIXTIME(created, ‘%d-%m-%Y %h:%i:%s’) from NewTB where FROM_UNIXTIME(created, ‘%Y’) = 2016”);

output : 30-06-2016 10:45:35

$sql = mysql_query(“select  *, FROM_UNIXTIME(created, ‘%d-%m-%Y’) from NewTB where
FROM_UNIXTIME(created, ‘%Y’) = 2016”);
output : 30-06-2016

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s