search on date without time

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

search on date without time

Postby chgog » Thu Nov 02, 2006 12:34 pm

Hello,
I would like to search a record by his date, without use his hours, minute or second.

I know I can use '#' symbol :

for example: #30/10/06 in the field and it work It return all record create the 30/10/06

But if I use <= #30/10/06 it return all record in my database and records created the 31/10/06

Thanks,
GOGUILLON Fabien
SOPADEV
SAN Developer
chgog
 
Posts: 130
Joined: Wed Dec 21, 2005 3:02 pm
Location: France / Anzin

Postby ROCLASI » Thu Nov 02, 2006 12:43 pm

Hi Fabien,

You need to add the dateformat in the searchstring.
If you check the Servoy help under Getting Started > Finding Data > Find dates and times you find the following:

Code: Select all
controller.find();
startDateTime = '#1-1-2004|MM-dd-yyyy';
controller.search();


There are also examples in the help for searching data ranges.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby chgog » Thu Nov 02, 2006 12:50 pm

I solved my problem. I change the time of my date and I execute my search method.

Code: Select all
globals.tp_datetime1 = new Date(globals.tp_datetime1.getFullYear(), globals.tp_datetime1.getMonth(), globals.tp_datetime1.getDate(), 23, 59, 59)

date =  "<= " + utils.dateFormat(globals.tp_datetime1,'dd/MM/yy HH:mm:ss') + '|dd/MM/yy HH:mm:ss';
GOGUILLON Fabien
SOPADEV
SAN Developer
chgog
 
Posts: 130
Joined: Wed Dec 21, 2005 3:02 pm
Location: France / Anzin


Return to How To

Who is online

Users browsing this forum: No registered users and 3 guests