Interface IReadOnlyProperty_Date
Represents a property of type date
Inherited Members
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public interface IReadOnlyProperty_Date : IReadOnlyProperty_Base, IReadOnlyElement, IAmlNode
Methods
| Improve this Doc View SourceAsDateTime()
Value converted to a System.Nullable<T> in the local timezone. If the value cannot be converted, an exception is thrown
Declaration
DateTime? AsDateTime()
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTime(DateTime)
Value converted to a System.DateTime in the local timezone using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
DateTime AsDateTime(DateTime defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime or |
Examples
// If the part was created after 2016-01-01, put the name of the creator in the description
if (comp.CreatedOn().AsDateTime(DateTime.MaxValue) > new DateTime(2016, 1, 1))
{
edits.Property("description").Set("Created by: " + comp.CreatedById().KeyedName().Value);
}
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTimeOffset()
Value converted to a System.Nullable<T> in the local timezone. If the value cannot be converted, an exception is thrown
Declaration
DateTimeOffset? AsDateTimeOffset()
Returns
Type | Description |
---|---|
System.Nullable<System.DateTimeOffset> | A System.DateTimeOffset or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTimeOffset |
AsDateTimeOffset(DateTimeOffset)
Value converted to a System.DateTimeOffset in the local timezone using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
DateTimeOffset AsDateTimeOffset(DateTimeOffset defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTimeOffset | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.DateTimeOffset | A System.DateTimeOffset or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTimeOffset |
AsDateTimeUtc()
Value converted to a System.Nullable<T> in the UTC timezone. If the value cannot be converted, an exception is thrown
Declaration
DateTime? AsDateTimeUtc()
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTimeUtc(DateTime)
Value converted to a System.DateTime in the UTC timezone using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
DateTime AsDateTimeUtc(DateTime defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |