Show / Hide Table of Contents

Struct DateStamp

Use this class to specify a particular date in the Gregorian calendar. Its intent to to be very clear that it represents a DATE, and not a moment in time, and to properly serialize and deserialize as such without the influence of timezone conversions.

Implements
IEquatable<DateStamp>
IComparable<DateStamp>
Namespace: FFT.TimeStamps
Assembly: FFT.TimeStamps.dll
Syntax
public struct DateStamp : IEquatable<DateStamp>, IComparable<DateStamp>

Constructors

| Improve this Doc View Source

DateStamp(Int32, Int32, Int32)

Initializes a new instance of the DateStamp struct.

Declaration
public DateStamp(int year, int month, int day)
Parameters
Type Name Description
System.Int32 year
System.Int32 month
System.Int32 day

Fields

| Improve this Doc View Source

DateTime

A DateTime set at exactly midnight of the day represented by this DateStamp. Its property is set equal to .

Declaration
public readonly DateTime DateTime
Field Value
Type Description
DateTime
| Improve this Doc View Source

MaxValue

Maximum possible DateStamp value of 9999-12-31.

Declaration
public static readonly DateStamp MaxValue
Field Value
Type Description
DateStamp
| Improve this Doc View Source

MinValue

Minimum possible DateStamp value of 0001-01-01.

Declaration
public static readonly DateStamp MinValue
Field Value
Type Description
DateStamp

Properties

| Improve this Doc View Source

Day

Gets the day component of the current value.

Declaration
public int Day { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

DayOfWeek

Gets the DayOfWeek component of the current value.

Declaration
public DayOfWeek DayOfWeek { get; }
Property Value
Type Description
DayOfWeek
| Improve this Doc View Source

Month

Gets the month component of the current value.

Declaration
public int Month { get; }
Property Value
Type Description
System.Int32
See Also
MonthStamp
| Improve this Doc View Source

MonthStamp

Gets the month component of the current value as a MonthStamp.

Declaration
public MonthStamp MonthStamp { get; }
Property Value
Type Description
MonthStamp
See Also
Month
| Improve this Doc View Source

UtcToday

Gets the current date in Utc timezone.

Declaration
public static DateStamp UtcToday { get; }
Property Value
Type Description
DateStamp
| Improve this Doc View Source

Year

Gets the year component of the current value.

Declaration
public int Year { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

AddDays(Int32)

Adds the given numDays to the current value.

Declaration
public DateStamp AddDays(int numDays)
Parameters
Type Name Description
System.Int32 numDays
Returns
Type Description
DateStamp
| Improve this Doc View Source

AddMonths(Int32)

Adds the given numMonths to the current value.

Declaration
public DateStamp AddMonths(int numMonths)
Parameters
Type Name Description
System.Int32 numMonths
Returns
Type Description
DateStamp
| Improve this Doc View Source

AddYears(Int32)

Adds the given numYears to the current value.

Declaration
public DateStamp AddYears(int numYears)
Parameters
Type Name Description
System.Int32 numYears
Returns
Type Description
DateStamp
| Improve this Doc View Source

CompareTo(DateStamp)

Declaration
public int CompareTo(DateStamp other)
Parameters
Type Name Description
DateStamp other
Returns
Type Description
System.Int32
| Improve this Doc View Source

CreateFrom(DateTime)

Creates a DateStamp from the given date parameter. Compute intensive. Do not use in hot path. date must be a DateTime with a) equal to , b) equal to .

Declaration
public static DateStamp CreateFrom(DateTime date)
Parameters
Type Name Description
DateTime date
Returns
Type Description
DateStamp
| Improve this Doc View Source

Equals(DateStamp)

Declaration
public bool Equals(DateStamp other)
Parameters
Type Name Description
DateStamp other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
| Improve this Doc View Source

FromString(ReadOnlySpan<Char>)

Parses a DateStamp from the format 'yyyy-MM-dd'. Compute intensive. Do not use in hot path.

Declaration
public static DateStamp FromString(ReadOnlySpan<char> value)
Parameters
Type Name Description
ReadOnlySpan<System.Char> value
Returns
Type Description
DateStamp
| Improve this Doc View Source

FromString(String)

Parses a DateStamp from the format 'yyyy-MM-dd'. Compute intensive. Do not use in hot path.

Declaration
public static DateStamp FromString(string value)
Parameters
Type Name Description
System.String value
Returns
Type Description
DateStamp
| Improve this Doc View Source

GetDaysSince(DayOfWeek)

Calculates the number of days that have elapsed between the current value and the most recent occurence of dayOfWeek. The result can range from 0 to 6.

Declaration
public int GetDaysSince(DayOfWeek dayOfWeek)
Parameters
Type Name Description
DayOfWeek dayOfWeek
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetDaysSince(DateStamp)

Calculates the difference between the current value and other. The result is a positive value if the current value is greater than other, negative otherwise.

Declaration
public int GetDaysSince(DateStamp other)
Parameters
Type Name Description
DateStamp other
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetDaysUntil(DayOfWeek)

Calculates the number of days that will pass from the current value until the soonest occurence of dayOfWeek. The result can range from 0 to 6.

Declaration
public int GetDaysUntil(DayOfWeek dayOfWeek)
Parameters
Type Name Description
DayOfWeek dayOfWeek
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetDaysUntil(DateStamp)

Calculates the difference between the current value and other. The result is a positive value if the current value is less than other, negative otherwise.

Declaration
public int GetDaysUntil(DateStamp other)
Parameters
Type Name Description
DateStamp other
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetEndTime()

Gets the moment at the end of the day (midnight of the following day) in UTC timezone.

Declaration
public TimeStamp GetEndTime()
Returns
Type Description
TimeStamp
| Improve this Doc View Source

GetEndTime(TimeZoneInfo)

Gets the moment at the end of the day (midnight of the following day) in the given timeZone.

Declaration
public TimeStamp GetEndTime(TimeZoneInfo timeZone)
Parameters
Type Name Description
TimeZoneInfo timeZone
Returns
Type Description
TimeStamp
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetStartTime()

Gets the moment at the beginning of the day (midnight) in UTC timezone.

Declaration
public TimeStamp GetStartTime()
Returns
Type Description
TimeStamp
| Improve this Doc View Source

GetStartTime(TimeZoneInfo)

Gets the moment at the beginning of the day (midnight) in the given timeZone.

Declaration
public TimeStamp GetStartTime(TimeZoneInfo timeZone)
Parameters
Type Name Description
TimeZoneInfo timeZone
Returns
Type Description
TimeStamp
| Improve this Doc View Source

IsWeekend()

Returns true if the current value is a Saturday or Sunday, false otherwise.

Declaration
public bool IsWeekend()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Max(DateStamp, DateStamp)

Returns the maximum of the given values.

Declaration
public static DateStamp Max(DateStamp v1, DateStamp v2)
Parameters
Type Name Description
DateStamp v1
DateStamp v2
Returns
Type Description
DateStamp
| Improve this Doc View Source

Max(DateStamp[])

Returns the maximum of the given values.

Declaration
public static DateStamp Max(params DateStamp[] values)
Parameters
Type Name Description
DateStamp[] values
Returns
Type Description
DateStamp
| Improve this Doc View Source

Min(DateStamp, DateStamp)

Returns the minimum of the given values.

Declaration
public static DateStamp Min(DateStamp v1, DateStamp v2)
Parameters
Type Name Description
DateStamp v1
DateStamp v2
Returns
Type Description
DateStamp
| Improve this Doc View Source

Min(DateStamp[])

Returns the minimum of the given values.

Declaration
public static DateStamp Min(params DateStamp[] values)
Parameters
Type Name Description
DateStamp[] values
Returns
Type Description
DateStamp
| Improve this Doc View Source

OrValueIfGreater(DateStamp)

Returns the greater of the two datestamps.

Declaration
public DateStamp OrValueIfGreater(DateStamp d)
Parameters
Type Name Description
DateStamp d
Returns
Type Description
DateStamp
| Improve this Doc View Source

OrValueIfLesser(DateStamp)

Returns the lesser of the two datestamps.

Declaration
public DateStamp OrValueIfLesser(DateStamp d)
Parameters
Type Name Description
DateStamp d
Returns
Type Description
DateStamp
| Improve this Doc View Source

Range(DateStamp, DateStamp)

Returns an enumerator that yields each date in the range from until to.

Declaration
public static IEnumerable<DateStamp> Range(DateStamp from, DateStamp to)
Parameters
Type Name Description
DateStamp from
DateStamp to
Returns
Type Description
IEnumerable<DateStamp>
| Improve this Doc View Source

SkipWeekendAndTheseDatesMovingBackward(IEnumerable<DateStamp>)

If the current value a weekday and not contained by datesToSkip, it will be returned. Otherise, the most recent weekday in the past that is not contained by datesToSkip will be returned.

Declaration
public DateStamp SkipWeekendAndTheseDatesMovingBackward(IEnumerable<DateStamp> datesToSkip)
Parameters
Type Name Description
IEnumerable<DateStamp> datesToSkip
Returns
Type Description
DateStamp
| Improve this Doc View Source

SkipWeekendAndTheseDatesMovingForward(IEnumerable<DateStamp>)

If the current value a weekday and not contained by datesToSkip, it will be returned. Otherise, the first weekday in the future that is not contained by datesToSkip will be returned.

Declaration
public DateStamp SkipWeekendAndTheseDatesMovingForward(IEnumerable<DateStamp> datesToSkip)
Parameters
Type Name Description
IEnumerable<DateStamp> datesToSkip
Returns
Type Description
DateStamp
| Improve this Doc View Source

SkipWeekendMovingBackward()

If the current value is a weekday, it will be returned unchanged. Otherwise, the most recent weekday in the past (a Friday) will be returned.

Declaration
public DateStamp SkipWeekendMovingBackward()
Returns
Type Description
DateStamp
| Improve this Doc View Source

SkipWeekendMovingForward()

If the current value is a weekday, it will be returned unchanged. Otherwise, the first weekday in the future (a Monday) will be returned.

Declaration
public DateStamp SkipWeekendMovingForward()
Returns
Type Description
DateStamp
| Improve this Doc View Source

Today(TimeZoneInfo)

Gets the current date in the timeZone given. Compute intensive. Do not use in hot path.

Declaration
public static DateStamp Today(TimeZoneInfo timeZone)
Parameters
Type Name Description
TimeZoneInfo timeZone
Returns
Type Description
DateStamp
| Improve this Doc View Source

ToString()

Expresses the value in the format 'yyyy-MM-dd'.

Declaration
public override string ToString()
Returns
Type Description
System.String
| Improve this Doc View Source

ToWeekFloor()

Returns the Sunday at the beginning of the week. The same value is returned if the value is already Sunday.

Declaration
public DateStamp ToWeekFloor()
Returns
Type Description
DateStamp

Operators

| Improve this Doc View Source

Equality(DateStamp, DateStamp)

Declaration
public static bool operator ==(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GreaterThan(DateStamp, DateStamp)

Declaration
public static bool operator>(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GreaterThanOrEqual(DateStamp, DateStamp)

Declaration
public static bool operator >=(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Inequality(DateStamp, DateStamp)

Declaration
public static bool operator !=(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LessThan(DateStamp, DateStamp)

Declaration
public static bool operator <(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LessThanOrEqual(DateStamp, DateStamp)

Declaration
public static bool operator <=(DateStamp left, DateStamp right)
Parameters
Type Name Description
DateStamp left
DateStamp right
Returns
Type Description
System.Boolean

Implements

IEquatable<>
IComparable<>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX