D
D
Danil2016-04-09 13:34:54
MySQL
Danil, 2016-04-09 13:34:54

How to select a time period from the base?

There are 2 columns with dates in the database: date(in which the date is in the format 09.04.2016) and date_utc(in which the date is in the format 1460193011379)
You need to select records from this database for a certain period, which is specified by two dates, for example, 01.04.2016and 15.04.2016
How to write such a query?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2016-04-09
@Veneomin

SELECT * FROM table_name WHERE date BEETWEN '2016-04-01' AND '2016-04-15'
or timestamp
SELECT * FROM table_name WHERE date_utc BEETWEN UNIX_TIMESTAMP('2016-04-01') AND UNIX_TIMESTAMP('2016-04- fifteen')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question