Jump 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.

Today Date In Search

Featured Replies

Hi all -- I have a script (thanks Garry!) that calculates today's date and formats it MM/DD/YYYY. I have placed it after <HEAD>:

<script>

Today = new Date();

var sTodayDate = (Today.getMonth() + 1) + "/" + Today.getDate() + "/" + Today.getFullYear();

</script>

I want to use the variable "sTodayDate" in performing searches so that outdated records are not pulled. For instance:

<form method=post action="FMPro"

<input type=hidden name="-find">

<input type=hidden name="-db" value="DesignCalendarDB.fp5">

<input type=hidden name="-format" value="onthecalendar.html">

<input type=hidden name="-op" value="gte">

<input type=hidden name="End Date" value="sTodayDate">

<input type=hidden name="-op" value="cn">

<p class="style26"><span class="style22">Search By Event Name:

<input type="text" name="Event Name">

<input type=hidden name="-max" value="10">

<input type=hidden name="-sortfield" value="Start Date">

<input type=hidden name="-sortorder" value="ascend">

<input type="submit" name="-find" value="Find Events">

<input type=hidden name="-error" value="noresultsfound.html">

</span></p>

</form>

In this piece of code, however, the inclusion of the variable "sTodayDate" does not work. The code works fine if I manually substitute "11/19/2004".

How do I plug in the variable so this works? Thanks, friends.

Rob,

A couple of methods exist to do this. One is to insert the value, via Javascript, when the Form is submitted. The second is to insert the while the page is being loaded.

Here is the "insertion while loading" method:

<form method=post action="FMPro"

<input type=hidden name="-find">

<input type=hidden name="-db" value="DesignCalendarDB.fp5">

<input type=hidden name="-format" value="onthecalendar.html">

<input type=hidden name="-op" value="gte">

<script>

Today = new Date();

var sTodayDate = (Today.getMonth() + 1) + "/" + Today.getDate() + "/" + Today.getFullYear();

document.write('<input type=hidden name="End Date" value="' + sTodayDate + '">');

</script>

<input type=hidden name="-op" value="cn">

<p class="style26"><span class="style22">Search By Event Name:

<input type="text" name="Event Name">

<input type=hidden name="-max" value="10">

<input type=hidden name="-sortfield" value="Start Date">

<input type=hidden name="-sortorder" value="ascend">

<input type="submit" name="-find" value="Find Events">

<input type=hidden name="-error" value="noresultsfound.html">

</span></p>

</form>

Good Luck.

Garry

  • Author

Garry is the Cavalry! Your solution is perfect as usual.

Best, and thanks once again,

Rob

Create an account or sign in to comment

Important Information

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

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.