This for me has always been an annoying thing, data is to be made of days, months and years and not a few numbers that have to be converted all the time.
I want to take a look at the database and say “son of a beautiful mother, he made the change and is now he´s saying that he did it three days ago.”
I hope you enjoy.
So there is the php version to convert
Normal date to UNIXTIME
<?php
echo 'date in unixtime :: '.strtotime('1th December 2011 11:12:34 PM (GMT)');
?>
So if you want other type of conversions, for example, just the day or without the time take a look at the php manual to see the many kind of uses
UNIXTIME for default time
<?php
echo 'Default date and time ::'.date('jS F Y h:i:s A (T)', '1256512354');
?>
Mysql version
mysql> SELECT UNIX_TIMESTAMP();
-> 1196440210
mysql> SELECT UNIX_TIMESTAMP('2007-11-30 10:30:19');
-> 1196440219
mysql> SELECT UNIX_TIMESTAMP('2005-03-27 03:00:00');
+---------------------------------------+
| UNIX_TIMESTAMP('2005-03-27 03:00:00') |
+---------------------------------------+
| 1111885200 |
+---------------------------------------+
mysql> SELECT UNIX_TIMESTAMP('2005-03-27 02:00:00');
+---------------------------------------+
| UNIX_TIMESTAMP('2005-03-27 02:00:00') |
+---------------------------------------+
| 1111885200 |
+---------------------------------------+