Johnny
Johnny

Reputation: 319

Echo results based on date UNIX_TIMESTAMP

I'm trying to build a statement view for my site so my users can view their income and out goings for the 14 day period basically what I'm having trouble with is echoing out the transactions for a 14 day period. every 14 days a new statement is generated how do I select all the entry's from a table from a specific date? for example 01/01/2016 to 14/01/2016. is there a specific script I can use to do this?

I'm going to upload the structure of my table to help you better understand what I'm asking.

enter image description here

Upvotes: 2

Views: 55

Answers (1)

Dan Walker
Dan Walker

Reputation: 453

Below is an SQL query based on your above table, this should select all transactions between the two required dates.

SELECT * FROM `tansactions`
WHERE `timestamp` >= UNIX_TIMESTAMP('2016-01-01 00:00:00')
AND `timestamp` <= UNIX_TIMESTAMP('2016-01-14 23:59:50');

Upvotes: 2

Related Questions