tibberous Posted December 18, 2008 Share Posted December 18, 2008 I need to get all of the records from the last 30 days. I was hoping to do math on dates like a normal timestamp, but mysql handles them weird. December 15, 2008 is 20081215 -- YYYYMMDD Can't do math on it. Is there a way to get dates in a format I can do math on? Like, as days from the epoch or something? Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/ Share on other sites More sharing options...
mmarif4u Posted December 18, 2008 Share Posted December 18, 2008 How you store your datetime in table field. Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/#findComment-718545 Share on other sites More sharing options...
tibberous Posted December 18, 2008 Author Share Posted December 18, 2008 It's just a date. Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/#findComment-718547 Share on other sites More sharing options...
haku Posted December 18, 2008 Share Posted December 18, 2008 That doesn't help at all. A date can look like any of these: 12/02/2008 2008/12/02 Dec 2 2008 December Second two-thousand-eight 448293582 And it can be in a date field or a text field or an int field (or more) in a database. So give us more info. Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/#findComment-718548 Share on other sites More sharing options...
mmarif4u Posted December 18, 2008 Share Posted December 18, 2008 Exactly what haku says. Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/#findComment-718549 Share on other sites More sharing options...
tibberous Posted December 18, 2008 Author Share Posted December 18, 2008 No, I mean, it's just a mysql date type. It's formatted as 1987-02-13. I think I figured it out - gotta use the datediff function. Link to comment https://forums.phpfreaks.com/topic/137492-selecting-a-date-range/#findComment-718550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.