Show / Hide Table of Contents

Struct MonthStamp

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

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

Constructors

| Improve this Doc View Source

MonthStamp(Int32, Int32)

Initializes a new instance of the MonthStamp struct.

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

Fields

| Improve this Doc View Source

DateTime

A DateTime set at exactly midnight of the first day of the month represented by this MonthStamp. 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.

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

MinValue

Minimum possible MonthStamp value of 0001-01-01.

Declaration
public static readonly MonthStamp MinValue
Field Value
Type Description
MonthStamp

Properties

| 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
| Improve this Doc View Source

UtcThisMonth

Gets the current month in Utc timezone.

Declaration
public static MonthStamp UtcThisMonth { get; }
Property Value
Type Description
MonthStamp
| 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

AddMonths(Int32)

Adds the given number of months to the current value and returns the result.

Declaration
public MonthStamp AddMonths(int numMonths)
Parameters
Type Name Description
System.Int32 numMonths

The number of months to add. Can be negative.

Returns
Type Description
MonthStamp
| Improve this Doc View Source

AddYears(Int32)

Adds the given number of months to the current value and returns the result.

Declaration
public MonthStamp AddYears(int numYears)
Parameters
Type Name Description
System.Int32 numYears

The number of years to add. Can be negative.

Returns
Type Description
MonthStamp
| Improve this Doc View Source

CompareTo(MonthStamp)

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

CreateFrom(DateTime)

Creates a MonthStamp from the given month parameter. month must be a DateTime with a) equal to , b) equal to 1, c) equal to .

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

Equals(MonthStamp)

Declaration
public bool Equals(MonthStamp other)
Parameters
Type Name Description
MonthStamp 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 MonthStamp from the format 'yyyy-MM'.

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

FromString(String)

Parses a DateStamp from the format 'yyyy-MM-dd'.

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

GetHashCode()

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

GetMonthsSince(MonthStamp)

Calculates the difference, in months, between the current value and other.

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

GetMonthsUntil(MonthStamp)

Calculates the difference, in months, between the current value and other.

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

Max(MonthStamp, MonthStamp)

Returns the maximum of the given values.

Declaration
public static MonthStamp Max(MonthStamp m1, MonthStamp m2)
Parameters
Type Name Description
MonthStamp m1
MonthStamp m2
Returns
Type Description
MonthStamp
| Improve this Doc View Source

Max(MonthStamp[])

Returns the maximum of the given values.

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

Min(MonthStamp, MonthStamp)

Returns the minimum of the given values.

Declaration
public static MonthStamp Min(MonthStamp m1, MonthStamp m2)
Parameters
Type Name Description
MonthStamp m1
MonthStamp m2
Returns
Type Description
MonthStamp
| Improve this Doc View Source

Min(MonthStamp[])

Returns the minimum of the given values.

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

OrValueIfGreater(MonthStamp)

Returns the greater of the two monthstamps.

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

OrValueIfLesser(MonthStamp)

Returns the lesser of the two monthstamps.

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

ToString()

Gets a string representation of the current value in the format yyyy-MM.

Declaration
public override string ToString()
Returns
Type Description
System.String

Operators

| Improve this Doc View Source

Equality(MonthStamp, MonthStamp)

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

GreaterThan(MonthStamp, MonthStamp)

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

GreaterThanOrEqual(MonthStamp, MonthStamp)

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

Inequality(MonthStamp, MonthStamp)

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

LessThan(MonthStamp, MonthStamp)

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

LessThanOrEqual(MonthStamp, MonthStamp)

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

Implements

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