Jump to content
Sign in to follow this  
quillpro

Help with a date script

Recommended Posts

I am trying to write a script that will calculate the difference between a date enter into a date field and the current date then return the result as a text string (Xyrs Xmos). I cannot get the month part to calculate correctly because the months do not occur in the same year always.

Example:

9-1-03 comparison date

11-1-04 current date

1yrs 2mos desired result

1-1-04 comparison date

11-1-04 current date

0yrs 10mos desired result

I am new to scripting in filemaker but not to scripting in general but have never work with dates before.

Any help is greatly appreciated.

-REM

Share this post


Link to post
Share on other sites

Unstored calculation field:

Let ( [ diff = second_date - first_date ] ;

( Month(diff) - 1) & " mos " & Day(diff) & " days " & (Year(diff) -1 ) & " yrs"

)

Share this post


Link to post
Share on other sites

For intermediate level programming, see Learn FileMaker 7. For advanced programming, see Using FileMaker 7.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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