last day (16 days later) » 

11:27 PM
0
A: find all records that are within the same day of another unix timestamp mysql

RiggsFollyIf you convert your timestamp to a DATE i.e. 2017-06-17 and also the timestamp field on your database you should get any row in that day SELECT * FROM table WHERE DATE(timestamp) = DATE(FROM_UNIXTIME('1494979200'));

 
The problem is the timestamp in my database is a unix timestamp
 
Did you try this
 
I did didnt work
 
Sorry, small typo, see amended code
 
getting Incorrect datetime value with your new changes
Remember that timestamp is also a unix timestamp
 
11:27 PM
Yes but DATE() should convert all those to a date in format yyyy-mm-dd
 
also I am using DATE(FROM_UNIXTIME('1494979200')) not DATE(FROM_UNIXTIME('1497664242'))
Check out the question I just edited it. I should have included all my code
 
I am looping through all dates from a start date until today. Then I want to pull all the records for that day that match the timestamp in the record. Sorry man brain fart.
 
while ($row = $result->fetch_array()) { shoudl be while ($row = $result_select ->fetch_array()) {
 
yeah I know I just hadn't gotten to that point yet lol
 
11:36 PM
Check the answer again
 
Getting Truncated incorrect date value
Sorry man for the drama I appreciate the help
 
From what line?
 
Warning: #1292 Truncated incorrect date value: '04/11/2019'
 
You need to use a YYYY-MM-DD format. Thats what MysQL understands
Notice I changed the date formats in your $start_date and the IF
 
My bad I didnt catch that. I made the changes and still getting Warning: #1292 Incorrect datetime value: '1505751843'
 
11:47 PM
Hmmm, thats a valid timestamp that = 2017-09-18
 
I made a screenshot of MySQL results so you can see the query is correct
 
Ok I see, but that makes no sense
Can you do a show create table xxx_tickets;
 
timestamp varchar(255) NOT NULL, Not sure why it is a VARCHAR shouldn't be
all my values are stored as a unix timestamp in the fields. It is not a date column
 
Well that might well explain the issue here. I was assuming it was a timestamp. That chnages things. Let me think a second
 

  last day (16 days later) »