ERPConnect.AbapTimestamp
Namespace: ERPConnect
Assembly: ERPConnectStandard20.dll
Represents an SAP timestamp, similar to System.DateTime
. Accuracy is ticks (100 nanoseconds). Both packed numbers (data elements TIMESTAMP, TIMESTAMPL) and native (type utclong) representations are supported.
public readonly struct AbapTimestamp : IComparable, IComparable<AbapTimestamp>, IEquatable<AbapTimestamp>
Implements
IComparable, IComparable<AbapTimestamp>, IEquatable<AbapTimestamp>
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
The Julian calendar is used from 0001-01-01 to 1582-10-04. The Gregorian calendar is used from 1582-10-15. The date range from 1582-10-05 to 1582-10-14 is invalid.
Constructors
AbapTimestamp(in ulong)
Initializes a new instance of ERPConnect.AbapTimestamp
from total ticks (100 nanoseconds passed since 01.01.0001).
Parameters
ticks
ulong
Exceptions
Ticks are outside the valid min or max range
AbapTimestamp(in ushort, in byte, in byte)
Initializes a new instance of ERPConnect.AbapTimestamp
using a 1-based year, month and day.
Parameters
year
ushort
month
byte
day
byte
Exceptions
The date is invalid. e.g. month 13 or 29.02. in any other year than a leap year.
AbapTimestamp(in ushort, in byte, in byte, in TimeSpan)
Initializes a new instance of ERPConnect.AbapTimestamp
using a 1-based year, month, day and the time of day.
Parameters
year
ushort
month
byte
day
byte
time
TimeSpan
Exceptions
The date is invalid. e.g. month 13 or 29.02. in any other year than a leap year.
Properties
Day
Gets the current day in currently represented ERPConnect.AbapTimestamp.Month
and ERPConnect.AbapTimestamp.Year
.
Property Value
InitialValue
Gets a constant value representing the initial value (0 ticks).
Property Value
MaxValue
Gets the maximum representable date and time. Currently this is 31.12.9999 23:59:59.99999999
Property Value
MinValue
Gets the minimum representable date and time. Currently this is 01.01.0001 00:00:00.0000000
Property Value
Month
Gets the current month in currently represented ERPConnect.AbapTimestamp.Year
.
Property Value
Ticks
Gets the total ticks. A single tick represents 100 nanoseconds since 01.01.0001.
Property Value
Time
Gets the current time of day.
Property Value
Year
Gets the currently represented year.
Property Value
Methods
AddDays(in int)
Adds (or subtracts) the specified amount of days from the currently represented date and time.
Parameters
days
int
Returns
Exceptions
The resulting ERPConnect.AbapTimestamp
is out of range of a representable date
AddHours(in int)
Adds (or subtracts) the specified amount of hours from the currently represented date and time.
Parameters
hours
int
Returns
Exceptions
The resulting ERPConnect.AbapTimestamp
is out of range of a representable date
AddMinutes(in long)
Adds (or subtracts) the specified amount of minutes from the currently represented date and time.
Parameters
minutes
long
Returns
Exceptions
The resulting ERPConnect.AbapTimestamp
is out of range of a representable date
AddSeconds(in long)
Adds (or subtracts) the specified amount of seconds from the currently represented date and time.
Parameters
seconds
long
Returns
Exceptions
The resulting ERPConnect.AbapTimestamp
is out of range of a representable date
AddTicks(in long)
Parameters
ticks
long
Returns
CompareTo(AbapTimestamp)
Parameters
other
AbapTimestamp
Returns
CompareTo(object)
Parameters
obj
object
Returns
Equals(AbapTimestamp)
Parameters
other
AbapTimestamp
Returns
Equals(object)
Parameters
obj
object
Returns
FromPackedNumber(in decimal)
Parameters
packedNumber
decimal
Returns
GetHashCode()
Returns
Parse(in string)
Parameters
abapString
string
Returns
ToString()
Returns
TryToDateTime(out DateTime?)
Tries to convert to the corresponding System.DateTime
value.
Parameters
value
DateTime?
Returns
Remarks
The ABAP values 0001-01-01 and 0001-01-02 cannot be converted. Assuming the proleptic Julian calendar, they would correspond to 0000-12-30 and 0000-12-31, which is out of range for System.DateTime
.
UtcNow()
Gets an ERPConnect.AbapTimestamp
representing the current date and time (UTC).
Returns
UtcToday()
Gets an ERPConnect.AbapTimestamp
representing the current date (UTC).