Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Unix Timestamp in MySQL

Tags:

sql

mysql

How do I create a unix timestamp in MySQL? I know the type is set to INT and value is NULL but I need it to populate with current time in the format like: 1343782742

like image 893
BarclayVision Avatar asked Jan 14 '23 10:01

BarclayVision


1 Answers

use UNIX_TIMESTAMP(date)

SELECT UNIX_TIMESTAMP(NOW())
  • SQLFiddle Demo

  • UNIX_TIMESTAMP

like image 109
John Woo Avatar answered Jan 17 '23 04:01

John Woo