Dinny Paul Dinny Paul - 4 years ago 108
MySQL Question

how to filter a select statement in mysql for a particular time period without using now()

I have tried to filter records but with the use of now function as given below

select * from table where date>= DATE_SUB( NOW( ) ,INTERVAL 90 DAY )

What I need is a select statement that can filter its records for a week or month from the current date but without using

Answer Source

if you are using java you could make use of the following code

String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());

or you could use curdate() of mysql

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download