CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 {Solved} Search on Date portion of DateTime

Print topic Send  topic

Author Message
clahti2

Posts: 107
Posted: 02/09/2012, 1:35 PM

Hello all:

I have a standard grid and search page, one of the grid fields is "last_updated" which is a DateTime field in the mysql database. I have a search field with date picker that returns only the date portion, not the time, I would like the search to find records for the given date regardless of the time it was updated. I think this should be easy but I seem to have a brain-fart.

Any help is greatly appreciated!
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/10/2012, 7:23 AM

clahti2,

simply create a query that has a field that converts the datetime field to a date field and search the date field.
View profile  Send private message
clahti2

Posts: 107
Posted: 02/15/2012, 10:06 PM

this is fixed, in the SQL you need to do something like

  
SELECT CONCAT(YEAR(last_update),"-",MONTH(last_update),"-",DAY(last_update)) AS date_only FROM foo  
and tie the search param to that field, which does not actually have to be present in the grid.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.