Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with date range search

Featured Replies

  • Newbies

Having trouble figuring out how to search by date range.

Here is what is have so far.

On my find page I enter my two dates for the range to search by.

<input type='text' name='startdate' value=''>

<input type='text' name='enddate' value=''>

On my Results page I pull my request values.

$startdate=$_REQUEST['startdate'];

$enddate=$_REQUEST['enddate'];

Then I add the Param...

$Search->AddDBParam('moddate',$startdate...$enddate);

I have tried this different ways with what I have seen posted but no luck.

Any help would be appreciated.

Try this:

$Search->AddDBParam('moddate',$startdate,'gte');

$Search->AddDBParam('moddate',$enddate,'lte');

Good Luck.

Garry

  • 2 months later...

How can I modify this to search for transactions within the last 30 days?

The concept is:

$newdate = getdate() - 30;

$search->AddDBParam(dateadded, $newdate);

$search->AddDBParam(-op, 'gt');

In english: show all transactions where 'dateadded' > $newdate.

See if this displays what you want (then search on it):

$newdate = time() - (30 * 24 * 60 * 60);

echo date('d/m/Y',$today);

Good Luck.

Garry

not bad Gary, it shows the date to search from. I fixed the one error in your post where it should be $newdate rather than $today.

Now to get the search to work.

Using:

$search->AddDBParam('-op','gt');

$search->AddDBParam('BookStore_DateAdded_Find',$newdate);

produced a random found set that would show one publication and each refresh, a new single publication would come up...

Gary,

Got it figured out and of course needed to translate the date from Australian (which you are) to Canadian to make it work. (ie in Canada it is date('m/d/Y', $newdate);

so the correct search for all new transaction in the past 20 days is:


$newdate = time() - (20 * 24 * 60 * 60);

$newdate2 = date('m/d/Y', $newdate);



$search->AddDBParam('DateAdded', $newdate2 , 'gte');

$searchResult=$search->FMFind();

Just FYI... I also did something like this with calculations in FM using status(CurrentDate) but it was only based on today. I forget the syntax, but it was something like

thisday = status(CurrentDate)

nextweek = thisday + 7

nextmonth = thisday +30

--ST

Look'in good :

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.