Getting seconds in Mysql
unix_timestamp() function return number of seconds in given date.
Example
select unix_timestamp(now());
Output
1398734374
1398734374 is the total number of seconds from now() date.
|
Getting present total milliseconds by Date in Mysql
unix_timestamp(now()) returns total number of seconds. So multiply this with 1000 to get total milliseconds like below.
Example
select unix_timestamp(now()) * 1000;
Output
1398734374000
|
To get total minutes by Date in mysql
unix_timestamp() divide by total seconds per minute(60) to get total minutes till now in mysql.
Example
select unix_timestamp(now()) / 60;
Output
23312240
|
Total hour by date in Mysql
unix_timestamp() divide by total seconds per minute(60) and total minutes per hour(60) to get total hours till now in mysql.
Example
select unix_timestamp(now()) / 60 / 60;
Output
388537
|