Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Using Tap Forms 5 › Calculating future date
- This topic has 12 replies, 3 voices, and was last updated 2 years ago by
Brendan.
-
AuthorPosts
-
June 5, 2023 at 10:42 AM #49542
Mike GuilbaultParticipantI’m sure it’s simple, but I can’t seem to get it right. How do you calculate a field to add “x” days from another date field? In other words, new date = date + 14 days (for example).
Thanks!
June 5, 2023 at 2:51 PM #49547
Daniel LeuParticipantHave a look at following response to a similar question: https://www.tapforms.com/forums/topic/how-to-increase-a-date-in-a-script/#post-49372
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 6, 2023 at 6:08 AM #49558
Mike GuilbaultParticipantAwesome… didn’t know about DATEADD. Now, how do I format it into YY-MM-DD. It’s returning the long date including time (May 25, 2023 at 12:00:00 AM).
I tried DATE(DATEADD([COMPLETED];0;0;0;14;0;0;0);”YY-MM-DD” but that didn’t work. Returned “December 31, 1969 at 12:00:00 AM”.
June 6, 2023 at 7:16 AM #49559
Daniel LeuParticipantDATE()
is the correct function to use with atext
return type. Or it might be that you are missing a closing bracket in your formulaDATE(DATEADD([COMPLETED];0;0;0;14;0;0;0);”YY-MM-DD”)
.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 6, 2023 at 7:23 AM #49560
Mike GuilbaultParticipantTried it again (checked my brackets). Unfortunately, that returns: Dec 31, 1969 at 7:00:23 PM
Back to square one.
June 6, 2023 at 10:22 AM #49562
Daniel LeuParticipantDid you set the the return type to
text
?-
This reply was modified 2 years ago by
Daniel Leu.
-
This reply was modified 2 years ago by
Daniel Leu.
Attachments:
You must be logged in to view attached files.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 6, 2023 at 10:23 AM #49563
Mike GuilbaultParticipantI tried it both ways. no go.
June 6, 2023 at 10:45 AM #49567
Daniel LeuParticipantStrange…. Let’s see if @brendan has an idea. BTW, it should be lower case “dd”, upper case “DD” is day of year. And lower case “yy” as well. Here is the link to the explanation of the format http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 6, 2023 at 10:49 AM #49568
Daniel LeuParticipantMaybe go back to your original implementation and set the date format in the field options.
-
This reply was modified 2 years ago by
Daniel Leu.
Attachments:
You must be logged in to view attached files.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 7, 2023 at 9:59 AM #49571
Mike GuilbaultParticipantThanks for the info on date formats… I was wondering how that worked.
June 7, 2023 at 10:05 AM #49572
Mike GuilbaultParticipantTHAT DID IT! I knew it would be something simple. Thanks Daniel. Much appreciated!
June 7, 2023 at 11:03 AM #49573
Daniel LeuParticipantGreat that this did the trick. It sill puzzles me why
DATE()
didn’t work for you.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksJune 8, 2023 at 11:27 AM #49574
BrendanKeymasterMy thoughts are if the Date Format setting worked, then the code was returning a Date value and not Text.
-
This reply was modified 2 years ago by
-
AuthorPosts
You must be logged in to reply to this topic.