1. Convert bigint type to datetime type
--Suppose 1164691264437 is the "datetime" in Java: that is, the number of milliseconds since 1970-01-01 00:00:00
/*
GetTime
Public Long GetTime () Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date o Bject.
Returns:
The number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
*/
mysql> Select From_unixtime (1164691264437/1000);
+-----------------------------------+
| from_unixtime (1164691264437/1000) |
+-----------------------------------+
| 2006-11-28 13:21:04 |
+-----------------------------------+
2, DateTime type converted to bigint type --Suppose "2011-05-31 23:59:59" is the "datetime" in Java: that is, the number of milliseconds since 1970-01-01 00:00:00
mysql> Select Unix_timestamp (' 2011-05-31 23:59:59 ');
+-----------------------------------+
| from_unixtime (1306857599/1000) |
+-----------------------------------+ |
1. Convert bigint type to datetime type --Suppose 1164691264437 is the "datetime" in Java: the number of milliseconds since 1970-01-01 00:00:00
/*
GetTime
Public Long GetTime () Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date o Bject.
Returns:
The number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
*/
mysql> Select From_unixtime (1164691264437/1000);
+-----------------------------------+
| from_unixtime (1164691264437/1000) |
+-----------------------------------+
| 2006-11-28 13:21:04 |
+-----------------------------------+
2, DateTime type converted to bigint type --Suppose "2011-05-31 23:59:59" is the "datetime" in Java: that is, the number of milliseconds since 1970-01-01 00:00:00
mysql> Select Unix_timestamp (' 2011-05-31 23:59:59 ');
+-----------------------------------+
| from_unixtime (1306857599/1000) |
+-----------------------------------+ |