
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
In MySQL, how can we represent the time value as an integer?
In MySQL, UNIX timestamp format is the way to represent time value as an integer. The integer value represented for the date value would be the number of seconds. The starting date for counting these number of seconds is ‘1970-01-01’.
mysql> SELECT UNIX_TIMESTAMP('2017-10-22 04:05:36')AS 'Total Number of Seconds'; +-------------------------+ | Total Number of Seconds | +-------------------------+ | 1508625336 | +-------------------------+ 1 row in set (0.00 sec)
The UNIX_TIMESTAMP value is 10 digits long.
- Related Articles
- How can we update any value in MySQL view as we can update the values in MySQL table?
- What is the range of date time value that we can pass as an argument to MySQL UNIX_TIMESTAMP function?
- How can we use the MySQL reserved words as an identifier?
- How can we fetch a MySQL SET column as a list of integer offset?
- How can we offload the time/date handling in MySQL?
- How can we notice that what is an integer?
- How can we represent vector quantities ?
- How can we calculate the difference between two time values in MySQL?
- In MySQL, how can we display time in other format specified by the user?
- How can we get the structure of a MySQL view as we can get the structure of a MySQL table?
- How can we get the definition of a MySQL view as we can get the definition of a MySQL table?
- How can we search a record from MySQL table having a date as a value in it?
- How can we list all the columns of a MySQL view as we can list the columns of a MySQL table?
- How to treat MySQL longtext as integer in MySQL query?
- How can we modify an existing MySQL event?

Advertisements