Jump to content

This topic is 7810 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi, folks! I made a form in which users submit dates et. al. via the web. I was confused when I saw the year showing up as 1903 for data submitted while my FileMaker creation/modification dates were showing 2003. After a little searching, I found this 2000 / 2001 thread mentioning something similar. Garry mentions JavaScript for his solution, but on a scale of 0-10, I am a 0.01 wrt JS -- even toward understanding his script. A search at FMP, Inc. website told me (although I missed it the first time around but caught it on a web page find) that FMP's "two-digit year date Interpretation Algorithm" only works within FMP itself and not for Web Companion (article below).

Is JavaScript still the way to go, or has anyone found another route?

If it's JS, can anyone copy/paste a script for me that will work for U.S. 9/14/03 that will covert 03 to 2003?

How do I create an INPUT for a JS variable and then put a resulting calc into my FMP field?

Thanxalot! --ST

----------------------------

YEAR 2000 ARTICLE: http://www.filemaker.com/ti/108216.html (CLIPPING BELOW)

Q: How does FileMaker Pro handle two-digit year dates?

A: As described in the Readiness Disclosure, in FileMaker Pro 3.0 through 6.0, two-digit year dates are handled differently depending on whether they are entered or edited directly in a date field, or entered from some other source (imported, input through the Web Companion or FileMaker Mobile, etc.). If you enter a two-digit year directly while editing a date field, FileMaker Pro 3.0 through 6.0 applies an "Interpretation Algorithm" to pick the century for the year. If the date is entered from some other source, FileMaker Pro 3.0 through 6.0 converts the two-digit year to "19xx" (not the current century, but actually "19xx") .

Posted

Steve,

I don't have a chance to test or even think about this too far, but could there be something involving a FileMaker calculation and IF? You'd have to split up the entry into a couple fields (month/date + year) and it would depend on what MIGHT be entered, but eg: if the YEAR number entered (02, 03, etc) is <60, add to 2000. If the number is greater then 60 (97, 98, etc), add to 1900. The resulting calculation, combined with the month/date field in a second calculation, could be then construed as a date?

Sounds too complicated, but maybe it'll suggest something to those with greater capabilities.

Ernie

Posted

Here is one that may work for you.

<script>

function fixdate()

{

sDate = document.myform.mydate.value.split("/")

if (sDate[2] < 2000)

{

sDate[2] = (sDate[2] - 0) + 2000 ;

document.myform.mydate.value = sDate.join("/") ;

} ;

document.myform.submit() ;

} ;

</script>

</head>

<body>

<form name="myform" action="FMPro" method="POST" onsubmit="Javascript:fixdate(); return false">

<input .....

Date (e.g. 1/13/03): <input type="text" name="mydate" value="">

....

All the best.

Garry

This topic is 7810 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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