Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › Help with calculating new date with Calculation Formula
Tagged: Adding years to a date
- This topic has 6 replies, 3 voices, and was last updated 6 years, 7 months ago by Brendan.
-
AuthorPosts
-
May 17, 2018 at 2:17 AM #28679
sweejinParticipantHello every one,
I am stuck with trying to add number of years from a number field to a date field. I have tried the various Date Functions in the Edit Formula option, however, I am unable to return the result I want in date format.
An example is:
adding
Warranty (years) = 3 [in number format], to
Date of Purchase = 3 May 2018 [in date format], equals to
End of Warranty = [in date format]Could some one advice which for the functions I should use?
Thank you in advance!
May 17, 2018 at 12:50 PM #28682
BrendanKeymasterHi Sweejin,
You will want to use the
DATEADD(Date;Y;M;W;D;H;M;S)
function to do this:Where Y = Years, M = Months, W = Weeks, D = Days, H = Hours, M = Minutes, and S = Seconds.
For your example, if would just be:
DATEADD(Date of Purchase;Warranty Years;0;0;0;0;0;0)
Hope that helps.
Also as a tip, you can put negative values in the different parameters to subtract from the specified date value.
Thanks!
Brendan
May 17, 2018 at 12:51 PM #28683
BrendanKeymasterOh, and make sure you set the Result Type of the Formula to Date.
May 26, 2018 at 8:56 PM #28783
EddzoParticipantI’m having issues with the syntax, I have a similar scenario.
Basically I have a table where one cell records
(Purchase Date:) the date I bought the item
(Warranty Years) # of years it has warranty
(Warranty Expires) Date my warranty is upThis is my calculation, but it doesn’t return a value.
DATEADD(Purchase Date;Warranty Years;M;W;D;H;M;S)
I selected display as date and nothing.What am I doing wrong?
May 26, 2018 at 9:13 PM #28784
BrendanKeymasterHi Eddzo,
Put 0’s in all the other spots instead of the letters.
Also, if it’s iOS, then the filename must be surrounded with square brackets. If it’s macOS, don’t type the field name in, double-click on the field on the left side instead to insert the field token into the formula.
Thanks,
Brendan
May 26, 2018 at 9:43 PM #28791
EddzoParticipantAlmost,
I got a return value but my numbers where way off,
I returned to edit the formula and selected, Return value as date.
Bam it works, BUT it displays a time at the end.Is there a way to eliminate the (time) at the end of the date under (Warranty Expiration Date)
I selected medium date, but its showing the timeAttachments:
You must be logged in to view attached files.May 26, 2018 at 11:32 PM #28794
BrendanKeymasterYes. Set the Date Format to one of the available numeric date formats and set the Time Format to Unspecified on the Calculation field.
-
AuthorPosts
You must be logged in to reply to this topic.