mySQL query in .jsp

Homerboy

Lifer
Mar 1, 2000
30,890
5,001
126
all of the entries in my database are timestamped: 20050620213625 (today)
I want to set up a query that will select all the data that was entered yesterday (on a day to day basis)

Anyone have any idea how to accomplish that?
 

Cheetah8799

Diamond Member
Apr 12, 2001
4,508
0
76
There is probably some sort of date-difference function that you can use to calculate dates.

Another way might be to generate a timstamp for 12am of the current day, so you'd get the current year, month, day and teh string would be "20050620000000". There are 6 zeros on the end of that because you want from midnight. Then do a query like this.

"select * from sometable where timestamped > mytimestring"

That should work. maybe. I know it works in MySQL. I'm not familiar with mSQL though, might have different functions and syntax.
 

Homerboy

Lifer
Mar 1, 2000
30,890
5,001
126
hahah
typo... Im using mySQL :p
Ill have to tinker with this and see what I can create.
I think something like:
java.sql.Date thisDate = new java.sql.Date(new java.util.Date()); then I can just insert that variable into the sql query.