Page 1 of 1
dates in-between
Posted: Fri May 28, 2010 2:20 pm
by shadowslash
How would I be able to get the dates in between Date A and Date B?
For example:
Date A is January 4, 2010
Date B is January 10, 2010
Now how would I be able to use Date A and Date B to produce the dates in-between them.
The result should be:
January 5, 2010
January 6, 2010
January 7, 2010
January 8, 2010
January 9, 2010
Has anybody encountered this problem? It has been a real blocker for a project that I'm working on.
Waiting for your answers,
Shedo Chung-Hee Surashu
Re: dates in-between
Posted: Fri May 28, 2010 10:36 pm
by jmburnod
Hi ShadowSlash,
I found a way, I hope that it is useful for you
Code: Select all
function DateBetween pStartDay,pEndDay
put pStartDay into depDate
put pEndDay into ArrDate
put depDate into UnedateD
convert unedateD to seconds
put ArrDate into UnedateA
convert unedateA to seconds
put unedateA-unedateD into difSec
put difSec/86400 into nbDays
repeat with i = 1 to nbDays-1
put unedateD+(i*86400) into OneDay
convert Oneday to short date
put Oneday& return after rDateBetween
end repeat
delete last char of rDateBetween
return rDateBetween
end DateBetween
Best
Jean-Marc
Re: dates in-between
Posted: Fri May 28, 2010 10:44 pm
by shadowslash
jmburnod wrote:I found a way, I hope that it is useful for you
Just what I needed!

Re: dates in-between
Posted: Sat May 29, 2010 10:06 am
by jmburnod
Hi,
Just what I needed!
I am happy there
I tested with bissextil year, it work nice
Be careful, i didnt test it with date before eon (1(1/70)
Best
Jean-Marc
Re: dates in-between
Posted: Sun Jun 06, 2010 5:34 am
by shadowslash
A quick question about this script, how do I make it also include the starting date and ending date to display among the list?
Re: dates in-between
Posted: Sun Jun 06, 2010 8:35 am
by jmburnod
if i understand what you want, this script add the pStartDay before the list and the pEndDay after the list
Code: Select all
function DateBetween pStartDay,pEndDay
put pStartDay into depDate
put pEndDay into ArrDate
put depDate into UnedateD
convert unedateD to seconds
put ArrDate into UnedateA
convert unedateA to seconds
put unedateA-unedateD into difSec
put difSec/86400 into nbDays
repeat with i = 1 to nbDays-1
put unedateD+(i*86400) into OneDay
convert Oneday to short date
put Oneday& return after rDateBetween
end repeat
--•• add pStartDay before the list and pEndDay after the list
--delete last char of rDateBetween
put pStartDay& return before rDateBetween
put pEndDay after rDateBetween
--•••
return rDateBetween
end DateBetween
Best
Jean-Marc
Re: dates in-between
Posted: Sun Jun 06, 2010 10:24 am
by shadowslash
Thanks! Works great!