The DateAndTime activity allow you to easily perform operations on DateTime objects within your workflow. These can be to generate DateTimes as strings, or make comparisons between DateTimes. In this example we aim to show the the basic steps that are required to get the activity integrated into a build.

Before you can make use of any of the TFS 2010 community build activities you have to make sure they are available for the build system and on your development PC. Instructions for this process can be found in the ALM Rangers build guide or in the StyleCop page of this wiki. This page assumes the DataAndTime activity is available in the developers build process workflow toolbox.

Step 1 Add some variables to store the DateTime

First we need to create a build variable to store the generated values. This will usually a String unless you are using the activity to get a boolean to make a branching decision

Step2 Add the DateAndTime activity

The activity can be added anywhere in the build workflow. The properties you need to set are dependant on the action selected


The minimum properties you need to set for each possible action are as follows

Action Required Optional Output
AddDays Format, Value Start Result
AddHours Format, Value Start Result
AddMilliseconds Format, Value Start Result
AddMinutes Format, Value Start Result
AddMonths Format, Value Start Result
AddSeconds Format, Value Start Result
AddTicks Format, Value Start Result
AddYears Format, Value Start Result
CheckBetween Start, End UseUtc BoolResult
CheckLater Start UseUtc BoolResult
Get Format UseUtc Result
GetElapsed Format, Start End, UseUtc Result

Last edited Sep 24, 2011 at 6:51 PM by rfennell, version 2


No comments yet.