mysql query to track the dateline (UNIX_TIMESTAMP)

Hello Experts,

I have a mysql database where date and time is stored in the dateline format (UNIX_TIMESTAMP).  I need a sql query which should pull up the data entered between two given timeline.

For ex:
In order to search the data which is entered today i use the following sql query:
SELECT * FROM table WHERE dateline > UNIX_TIMESTAMP(CONCAT(CURDATE(), ' ', '00:00:00'))

Now what i am looking for is a sql query to pull up the data entered between two given dates.

Thanks

Shiva_KumarAsked:
Who is Participating?
 
Kevin CrossConnect With a Mentor Chief Technology OfficerCommented:
Hello Shiva_Kumar,

I would use a between statement:
SELECT * FROM table WHERE dateline BETWEEN UNIX_TIMESTAMP('2008-10-06 00:00:00') AND  UNIX_TIMESTAMP('2008-11-06 23:59:59');

OR

I would use two statements:
SELECT * FROM table WHERE dateline > UNIX_TIMESTAMP('2008-10-06 00:00:00') AND dateline < UNIX_TIMESTAMP('2008-11-07 00:00:00');

Regards,

mwvisa1
0
 
Shiva_KumarAuthor Commented:
Thanks Buddy... It worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.