dates in-between
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
- 
				shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
dates in-between
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
			
			
									
									
						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
Hi ShadowSlash,
I found a way, I hope that it is useful for you
Best
Jean-Marc
			
			
									
									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
Jean-Marc
https://alternatic.ch
						- 
				shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Re: dates in-between
Just what I needed!jmburnod wrote:I found a way, I hope that it is useful for you
Re: dates in-between
Hi,
I tested with bissextil year, it work nice
Be careful, i didnt test it with date before eon (1(1/70)
Best
Jean-Marc
			
			
									
									I am happy thereJust what I needed!
I tested with bissextil year, it work nice
Be careful, i didnt test it with date before eon (1(1/70)
Best
Jean-Marc
https://alternatic.ch
						- 
				shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Re: dates in-between
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
if i understand what you want, this script add the pStartDay before the list and the pEndDay after the list
Best
Jean-Marc
			
			
									
									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
Jean-Marc
https://alternatic.ch
						- 
				shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:


