Appointment.Duration Appointment.Duration Appointment.Duration Appointment.Duration Appointment.Duration Property

Definition

Gets or sets a time span that represents the time duration of the appointment. Duration is of type TimeSpan and must be non-negative.

public : TimeSpan Duration { get; set; }
TimeSpan Duration();

void Duration(TimeSpan duration);
public TimeSpan Duration { get; set; }
Public ReadWrite Property Duration As TimeSpan
var timeSpan = appointment.duration;
appointment.duration = timeSpan;

Property Value

TimeSpan TimeSpan TimeSpan

A time span that represents the duration of the appointment. The duration can't be a negative value.

Additional features and requirements

Capabilities
appointmentsSystem

Remarks

This property uses a time span value, which is represented differently depending on which language you are programming with.

  • In JavaScript, set the Duration value with a Number that represents the time interval. Each unit for a TimeSpan value represents 1 millisecond. For example, this code sets a Duration value to 60 minutes (one hour). ```javascript appointment.duration = (60 * 60 * 1000); // 1 hour in 1-millisecond units


+ In Visual C++ component extensions (C++/CX), use a @Windows.Foundation.TimeSpan?text=TimeSpan structure value with a **Duration** value. In Visual C++ component extensions (C++/CX), each unit for a **Duration** value represents 100 nanoseconds.
+ In C# or Microsoft Visual Basic, you use a [System.TimeSpan](https://docs.microsoft.com/dotnet/api/system.timespan?redirectedfrom=MSDN) value. You can use utility API of [System.TimeSpan](https://docs.microsoft.com/dotnet/api/system.timespan?redirectedfrom=MSDN) such as [FromSeconds](https://docs.microsoft.com/dotnet/api/system.timespan.fromseconds) to generate a [System.TimeSpan](https://docs.microsoft.com/dotnet/api/system.timespan?redirectedfrom=MSDN) and set the value.




> [!NOTE]
> In JavaScript, @Windows.Foundation.TimeSpan?text=TimeSpan is accessed as a value, not as an object. For example, use `var a = 10000`, not `var a = { duration: 10000 }`. Also, in JavaScript, @Windows.Foundation.TimeSpan?text=TimeSpan is treated as the number of millisecond intervals, not the number of 100-nanosecond intervals so you can lose precision when you port @Windows.Foundation.TimeSpan?text=TimeSpan values between languages.