Page 1 of 1

Interval between timestamps

Posted: Mon Jan 05, 2015 5:48 am
by asmund
Is it possible to get the interval between two timestamps as a scalar number, or to have the timestamp task return a scalar value, for example an astronomical Julian day? I need to loop over (Year, DOY) for a date range that may include Jan 1, and it would be nice to not have to handle the year change manually.

Re: Interval between timestamps

Posted: Mon Jan 05, 2015 8:56 am
by Support_Rick
asmund,

On the TIMESTAMP Task .. there is a Date Manipulation Tab. This will allow you to create a Date Variable (yyyyDDD) implicitly or based on current date.

This means that you can specifically give it the Year, Month, Day and it will create the variable for that date.

Code: Select all
<timestamp version="1.0">
	<format outputVariable="JulDate" pattern="yyyyDDD" dayOfMonth="21" month="7" year="2015" />
</timestamp>

01/05/2015 06:40:36           INFO      Executing task 'print 1.0'
01/05/2015 06:40:36           INFO      Julian Date->  2015202
01/05/2015 06:40:36           INFO      Finished task 'print 1.0'
Or, you could manipulate based on current date:
Code: Select all
<timestamp version="1.0">
	<format outputVariable="JulDate" pattern="yyyyDDD" month="+15" />
</timestamp>

01/05/2015 06:43:18           INFO      Executing task 'print 1.0'
01/05/2015 06:43:18           INFO      Julian Date->  2016096
01/05/2015 06:43:18           INFO      Finished task 'print 1.0'
Your only other option is to call an SQL Function to return the value you are looking for based on some date manipulation algorithm. An option for this might be to create a Utility Project that returns a single value from an SQL Function. There is a function here on the Forum called SQL Help that might give you some direction on this option.

SQL Help