Gets the current date and time.
Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)
Syntax
Example
Using the Time task to get the Month, Day, Year, Hour, Minute, and Second:
Copy Code | |
---|---|
<Time> <Output TaskParameter="Month" PropertyName="Month" /> <Output TaskParameter="Day" PropertyName="Day" /> <Output TaskParameter="Year" PropertyName="Year" /> <Output TaskParameter="Hour" PropertyName="Hour" /> <Output TaskParameter="Minute" PropertyName="Minute" /> <Output TaskParameter="Second" PropertyName="Second" /> </Time> <Message Text="Current Date and Time: $(Month)/$(Day)/$(Year) $(Hour):$(Minute):$(Second)" /> |
Copy Code | |
---|---|
<Time Format="yyyyMMddHHmmss"> <Output TaskParameter="FormattedTime" PropertyName="buildDate" /> </Time> |
Remarks
See DateTimeFormatInfo for the syntax of the format string.
Inheritance Hierarchy
Thread Safety
Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
See Also
Documentation version 1.0.0.0.