|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
I have a form field that I am populating with a date (mm/dd/yyyy), and I want to search a database column of dates (yyyy-mm-dd hh:mm:ss).
I am new to php and having problems finding matching dates in the database... Can anyone show me a sample query? Thanks for any help! b |
|
#2
|
|||
|
|||
|
Well, first you gonna need to re-format the date in the form field to match the date string in your database:
list($month, $day, $year) = split("/", "mm/dd/yyyy"); $new_date = $year . "-" . $month . "-" . $day; You can use substring in your sql statement to search on part of the date field: select * from db where substring(date_stamp, 1, 10) = 'yyyy-mm-dd' Some good resources for you to take a look at: URL URL |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > search by date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|