User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,582 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 252 | Replies: 3
Reply
Join Date: Mar 2008
Posts: 63
Reputation: sukhy_1 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
sukhy_1 sukhy_1 is offline Offline
Junior Poster in Training

small error with dates

  #1  
Mar 30th, 2008
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.

  1. $sql = "SELECT DayofWeek, Bookingdate,
  2. FROM peter
  3. WHERE Bookingdate
  4. BETWEEN '%$value1%'
  5. AND '%$value2%';
  6.  
Last edited by peter_budo : Apr 1st, 2008 at 6:59 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 102
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
mwasif mwasif is offline Offline
Junior Poster

Re: small error with dates

  #2  
Mar 30th, 2008
In MySQL dates are saved in YYYY-MM-DD.
Reply With Quote  
Join Date: Mar 2008
Posts: 63
Reputation: sukhy_1 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 3
sukhy_1 sukhy_1 is offline Offline
Junior Poster in Training

Re: small error with dates

  #3  
Mar 30th, 2008
Hello what if i save them in text?? cant i use the like statement
Reply With Quote  
Join Date: Dec 2007
Posts: 102
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 12
mwasif mwasif is offline Offline
Junior Poster

Re: small error with dates

  #4  
Mar 30th, 2008
You can use LIKE but can not use BETWEEN.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 6:36 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC