Example ASP.NET control (embedded):
The TimeSpanLabel control is initialized with the following code:
<NhsCui:TimeSpanLabel ID="TimeSpanLabel1" runat="server"
To="13 Sep 2010" UnitLength="Short" />
- From – gets or sets the date and time which mark the start
of the time span
- IsAge – specifies whether the time span represents an age
- Granularity – specifies the largest units to be displayed;
its value depends on the status of IsAge and may be seconds, minutes, hours, days,
weeks, months or years
- Threshold – specifies the smallest units to be displayed;
its value depends on the status of IsAge and may be seconds, minutes, hours, days,
weeks, months or years
- To – gets or sets the date and time which mark the end of
the time span
- UnitLength – indicates whether short or long units should
be used
- Value – gets or sets the value to be displayed by the label
If IsAge is:
- “True”, the Granularity and Threshold property values are set from the
time span
- “False”, the Granularity and Threshold property values are set from
the assigned Granularity and Threshold property values
The following table provides guidance on how the Granularity and Threshold values
are set from the time span.  
|
Time span
|
Granularity
|
Threshold
|
|
Less than 2 hours
|
Minutes (TimeSpanUnits.Minutes)
|
Minutes (TimeSpanUnits.Minutes)
|
|
Less than 2 days
|
Hours (TimeSpanUnits.Hours)
|
Hours (TimeSpanUnits.Hours)
|
|
Less than 4 weeks
|
Days (TimeSpanUnits.Days)
|
Days (TimeSpanUnits.Days)
|
|
Less than 1 year
|
Weeks (TimeSpanUnits.Weeks)
|
Days (TimeSpanUnits.Days)
|
|
Less than 2 years
|
Months (TimeSpanUnits.Months)
|
Days (TimeSpanUnits.Days)
|
|
Less than 18 years
|
Years (TimeSpanUnits.Years)
|
Months (TimeSpanUnits.Months)
|
|
Greater than or equal to 18 years
|
Years (TimeSpanUnits.Years)
|
Years (TimeSpanUnits.Years)
|