Nicholas MacLeod
Nicholas MacLeod

Reputation: 1

Impossible date issue with formatDate formula

I have written a simple function to track payments, and as part of the function want to keep track of the last amount paid and the date the last payment was made within a single cell.

In order to do this, I used the formatDate formula so that the date entered via a date picker would appear in the DD/MM/YY format.

For some reason, the dates entered via the date picker are not working properly with the formatDate formula. For example the date 10/2/20 (10th Feb 2020) is being returned as 41/2/20 and 20/2/20 (20th Feb 2020) is being returned as 51/2/20.

Obviously, it seems like the formula is somehow adding 31 to the dates entered, but I would like some help understanding where I am going wrong.

Here is a picture of the code for my addPayment function: addPayment function code

Upvotes: 0

Views: 31

Answers (1)

Cooper
Cooper

Reputation: 64140

It was suggested to that Utilities.formatDate() was not working with the format string of “DD/MM/YY” and I simply suggested to try “dd/MM/yy”

Upvotes: 1

Related Questions