how to query records where today - date field <= 3 days

1 view
Skip to first unread message

lkasdorf

unread,
Apr 16, 2008, 12:38:01 AM4/16/08
to Php Object Generator
I need to select records based on a datetime field. I need just the
last 3 days' records.

Is this possible in a POG search?

I saw a discussion in which it was suggested to use an int for dates,
but it would complicate my life quite a bit to change this field type.

I have discovered how to do the search if I was doing a normal SQL
search, but I don't know how using the POG syntax.

Thanks
Lynn Kasdorf

Joel

unread,
Apr 16, 2008, 12:58:04 AM4/16/08
to Php Object Generator
what's your sql query?

andy law (RI)

unread,
Apr 16, 2008, 4:26:47 AM4/16/08
to Php-Object...@googlegroups.com
Lynn,

Look up strtotime() and date() functions on php.net (now '-3 day')

Then, once you've got your cut-off date in a string, use

$object->GetList(array(array("fieldname", ">", "$cutoff")));

Later,

Andy

-------------
Yada, yada, yada...

Roslin Institute is a company limited by guarantee, registered in
Scotland (registered number SC157100) and a Scottish Charity (registered
number SC023592). Our registered office is at Roslin, Midlothian, EH25
9PS. VAT registration number 847380013.

The information contained in this e-mail (including any attachments) is
confidential and is intended for the use of the addressee only. The
opinions expressed within this e-mail (including any attachments) are
the opinions of the sender and do not necessarily constitute those of
Roslin Institute (Edinburgh) ("the Institute") unless specifically
stated by a sender who is duly authorised to do so on behalf of the
Institute.

Reply all
Reply to author
Forward
0 new messages