NAnt SDK Documentation - v0.92

TimeSpanFunctions.GetDays Method 

Returns the number of whole days represented by the specified TimeSpan.

[Visual Basic]
<Function(Name:="get-days")>
Public Shared Function GetDays( _
   ByVal value As TimeSpan _
) As Integer
[C#]
[Function(Name="get-days")]
public static int GetDays(
   TimeSpan value
);

Parameters

value
A TimeSpan.

Return Value

The number of whole days represented by the given TimeSpan.

Example

Remove all files that have not been modified in the last 7 days from directory "binaries".

    
<foreach item="File" in="binaries" property="filename">
    <if test="${timespan::get-days(datetime::now() - file::get-last-write-time(filename)) >= 7}">
        <delete file="${filename}" />
    </if>
</foreach>
    
  

See Also

TimeSpanFunctions Class | NAnt.Core.Functions Namespace