-1

I'm trying to get the difference between the 2 dates in googlescript. However it doesn't seem to be working. Does anyone seem to know why? My user defined variables are working it's just when i get the difference between the 2 the result is like 4.28E8 whereas the answer is supposed to be like 40. Is there a way to convert the date into a number then convert it back into a date?

 ddate = output.getRange(lRow2,2,1,1).getValue() - output.getRange(2,1,1,1).getValue()
sandrosil
  • 543
  • 3
  • 9
  • 21

1 Answers1

1

Function works, its just the difference is in milliseconds. For those interested in the conversion, it's as follows:

diff = ((output.getRange(lRow2,2,1,1).getValue() - output.getRange(2,1,1,1).getValue()) / (1000*60*60*24))

or simply:

days = milliseconds/ (1000*60*60*24)

sandrosil
  • 543
  • 3
  • 9
  • 21