Class SepaDateUtil

Namespace
Subsembly.Sepa
Assembly
Subsembly.Sepa.dll

Utility methods for working with SEPA dates and schedules.

public static class SepaDateUtil
Inheritance
SepaDateUtil
Inherited Members

Properties

CetNow

Returns the current Central European Date and Time, regardless of the local timezone of this computer.

public static DateTime CetNow { get; }

Property Value

DateTime

Remarks

If the local timezone of this computer already is the CET time zone, then the DateTime.Kind property will be DateTimeKind.Local. If the local timezone of this computer is any other time zone, then the DateTime.Kind property will be DateTimeKind.Unspecified.

CetToday

Returns the current Central European Date, regardless of the local timezone of this computer.

public static DateTime CetToday { get; }

Property Value

DateTime

Remarks

If the local timezone of this computer is the Central European Time Zone, then the DateTime.Kind property will be DateTimeKind.Local. If the local timezone of this computer is any other time zone, then the DateTime.Kind property will be DateTimeKind.Unspecified.

IsCentralEuropeanTime

Indicates whether the local time zone of this computer equals the Central European Time Zone.

public static bool IsCentralEuropeanTime { get; }

Property Value

bool

Methods

ConvertToCet(DateTime)

Converts a given date and time of any kind to the same point in time at the Central European Time Zone.

public static DateTime ConvertToCet(DateTime tDateTime)

Parameters

tDateTime DateTime

The date and time to be converted.

Returns

DateTime

With the exception of DateTime.MinValue and DateTime.MaxValue, if the computers local time zone is the Central European Time Zone, then the returned DateTimeKind will always be set to Local. If the computers local time zone is different, then the returned DateTimeKind is Unspecified.

Remarks

If tDateTime is DateTime.MinValue or DateTime.MaxValue, then this method does nothing and just returns the given parameter. The DateTime.Kind is ignored in this case.

If the DateTime.Kind of the parameter is DateTimeKind.Unspecified, then it is assumed to already be a CET date time specification and no conversion is done.

If the DateTime.Kind of the parameter is DateTimeKind.Local, and the computers local time zone is not the Central European Time Zone, then it is converted from the computers local time zone to the CET time zone.

If the DateTime.Kind of the parameter is DateTimeKind.Utc, then it is converted from UTC to the CET time zone.

ConvertToLocal(DateTime)

Converts a given date and time of any kind to the same point in time at the compüuters local time zone.

public static DateTime ConvertToLocal(DateTime tDateTime)

Parameters

tDateTime DateTime

The date and time to be converted.

Returns

DateTime

With the exception of DateTime.MinValue and DateTime.MaxValue, the DateTime.Kind of the returned DateTime is always DateTimeKind.Local.

Remarks

If tDateTime is DateTime.MinValue or DateTime.MaxValue, then this method does nothing and just returns the given parameter. The DateTime.Kind is ignored in this case.

If the DateTime.Kind of the parameter is DateTimeKind.Unspecified, then it is assumed to be a CET date time specification. If the computers local time zone is CET, then the DateTime.Kind will simply be set to DateTimeKind.Local. Otherwise, the date/time is converted from CET to the computers local time.

If the DateTime.Kind of the parameter is DateTimeKind.Local, then this method does nothing and just returns the given parameter.

If the DateTime.Kind of the parameter is DateTimeKind.Utc, then the parameter is converted from UTC to the computers local time.

ConvertToUtc(DateTime)

Converts a given date and time of any kind to the same point in time at the UTC Time Zone.

public static DateTime ConvertToUtc(DateTime tDateTime)

Parameters

tDateTime DateTime

The date and time to be converted.

Returns

DateTime

With the exception of DateTime.MinValue and DateTime.MaxValue, the DateTime.Kind of the returned DateTime is always DateTimeKind.Utc.

Remarks

If tDateTime is DateTime.MinValue or DateTime.MaxValue, then this method does nothing and just returns the given parameter. The DateTime.Kind is ignored in this case.

If the DateTime.Kind of the parameter is DateTimeKind.Unspecified, then it is assumed to be a CET date time specification and is converted from CET to UTC time.

If the DateTime.Kind of the parameter is DateTimeKind.Local, then it is converted from the computers local time zone to the UTC time zone.

If the DateTime.Kind of the parameter is DateTimeKind.Utc, then the parameter is returned as is.

GetNextBankBusinessDay()

Determine the next bank business day (never today).

public static DateTime GetNextBankBusinessDay()

Returns

DateTime

The returned date is at least tomorrows date, but may be further in the future because of weekends and public holidays.

GetNextBankBusinessDay(DateTime)

Returns the bank business day following the given date.

public static DateTime GetNextBankBusinessDay(DateTime tDate)

Parameters

tDate DateTime

The date for which to return the next bank business date. The time of day of this value will be maintained in the return value.

Returns

DateTime

The returned date is at least one day after tDate, but may be further in the future because of weekends and public holidays. If the parameter tDate was DateTime.MinValue, then DateTime.MinValue is returned.

GetPreviousBankBusinessDay(DateTime)

Returns the bank business day preceeding the given date.

public static DateTime GetPreviousBankBusinessDay(DateTime tDate)

Parameters

tDate DateTime

The date for which to return the previous bank business date. The time of day of this value will be maintained in the return value.

Returns

DateTime

The date of the previous bank business day. If the parameter tDate was DateTime.MinValue, then DateTime.MinValue is returned.

IsBankBusinessDay(DateTime)

Check whether the given date is a bank business day.

public static bool IsBankBusinessDay(DateTime tDate)

Parameters

tDate DateTime

Returns

bool