Hello this statement below works when the date is set as 02/02/2008 but when i enter it like this 2/2/2008 it dont search the date, in the database the date is set as 2/2/2008 because i need it in that format. i want to search dates from and to like i have wrote in the statement.

$sql = "SELECT DayofWeek, Bookingdate,  
FROM peter
WHERE Bookingdate
BETWEEN '%$value1%'
AND '%$value2%';

Recommended Answers

All 3 Replies

In MySQL dates are saved in YYYY-MM-DD.

Hello what if i save them in text?? cant i use the like statement

You can use LIKE but can not use BETWEEN.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.