Vijay
Vijay

Reputation: 5433

how to check now() falls between two specific dates?

I've a announcement table with the structure,

Msgid int,
title varchar(150)
message text
date_from datetime
date_to  datetime

I've want to list all the announcements which will be due today (i.e) announcements of which today's date falls b/w date_from and date_to.

any ideas?

Upvotes: 6

Views: 16918

Answers (2)

Treffynnon
Treffynnon

Reputation: 21553

SELECT title, message
FROM announcements
WHERE NOW() BETWEEN date_from AND date_to

Upvotes: 0

reko_t
reko_t

Reputation: 56430

WHERE NOW() BETWEEN date_from AND date_to

Upvotes: 28

Related Questions