Turning Number Sequence into Date with PHP and SQL

1

I have a database that has a numeric sequence written to a table that means a date of publication of an article. I would like to know if anyone can decipher this number sequence so I can print the correct date through PHP.

For example:

1464880280 = 02/06/2016
1465580280 = 10/06/2016
1466513100 = 21/06/2016

Can anyone decipher and help me create a function to display this converted date?

    
asked by anonymous 22.06.2016 / 16:55

2 answers

5

This numerical sequence is the date in UNIX Timestamp format. Conversion function already exists.

Example in php:

echo date('d/m/Y', 1464880280);
echo date('d/m/Y', 1465580280);
echo date('d/m/Y', 1466513100);

For more information access .

    
22.06.2016 / 17:01
3

You can also format it in MySQL using / a> and DATE_FORMAT :

Example:

SELECT DATE_FORMAT(FROM_UNIXTIME(1464880280),'%d/%m/%Y %H:%i') as dt;
    
22.06.2016 / 18:46