ScriptSpot

Forum topic · Scripts Wanted

script to calculate days between two dates

By symmetry · 2013-04-15

Description

Hi,

Does anyone know if a string can be converted to a date i.e. "23/09/2013" so that I could simply subtract a number from it and display the new date. something like the following:

oldDate = Date("23/09/2013")
newDate = oldDate - 10

print newDate as string

giving me a result "13/09/2013"

Currently the only way I can do this is to create an array of days, months and years so as to calculate based on which month has which number of days and which year is a leap year. This method works fine but is very long winded.

Comments (1)

Go here.

miauu · 2013-04-15