I have to migrate old data to a new website and in the mysql-table is a column called date with a example value of "1308355200" but which datenformat is that can you help me?
Asked
Active
Viewed 64 times
-2
-
1That's an [unix timestamp](https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestamp) – KhorneHoly Dec 21 '16 at 10:16
-
3Possible duplicate of [Convert Unix timestamp into human readable date using MySQL](http://stackoverflow.com/questions/6267564/convert-unix-timestamp-into-human-readable-date-using-mysql) – KhorneHoly Dec 21 '16 at 10:17
-
1If it's a unix timestamp, then it's Sat, 18 Jun 2011 00:00:00 GMT – Mark Baker Dec 21 '16 at 10:19
2 Answers
1
This is a Timestamp
Convert to date:
$timestamp = "1308355200"; //This is a Timestamp.
echo date('d-m-Y',$timestamp); //Convert to date.
Result:
2011-06-18
Refer Date format: http://php.net/manual/en/function.date.php

Ramalingam Perumal
- 1,367
- 2
- 17
- 46
1
Explainations
A timestamp is a way to communicate a date easily. You are aware that in some region, date format are not the same. And that's a problem in programing because we would have to manage every format, in every programing language. Timestamp is universal and most of the programing language (if not all of them) are able to manage timestamp.
Now, PHP offers you a way to translate that timestamp into something more readable with the date()
function.
Source-code
<?php
/* database processing here... */
$date = 1308355200; /* value you got from a database query */
$datestring = date('d F, Y', $date);
/* d : day, F : full month, Y : year */
echo 'The date we got from the database: ' . $datestring;
Output
The date we got from the database: 17 June, 2011
Documentation
Online demo

Amin NAIRI
- 2,292
- 21
- 20