C# Class NSupport.DateTimeOffsetCalculations

Provides extension methods for DateTimeOffset for calcualtions.
Mostra file Open project: jittuu/NSupport

Public Methods

Method Description
Advance ( this source, int years, int months, int days, int hours, int minutes, int seconds ) : DateTimeOffset

Returns a new System.DateTimeOffset that adds the provided parameters (years, months, days, hours, minutes, seconds) value/s.

Ago ( this source, int years, int months, int days, int hours, int minutes, int seconds ) : DateTimeOffset

Returns a new System.DateTimeOffset that minus the provided parameters (years, months, days, hours, minutes, seconds) value/s.

BeginningOfDay ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset with the time value set to 12:00:00 midnight (00:00:00).

BeginningOfMonth ( this source ) : DateTimeOffset

Returns the first day of the current month with the time value set to 12:00:00 midnight (00:00:00).

BeginningOfQuarter ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset representing the start of the current quarter (1st of January, April, July, October) with the time value set to 12:00:00 midnight (00:00:00).

BeginningOfWeek ( this source ) : DateTimeOffset

Returns the first day of the current week with the time value set to 12:00:00 midnight (00:00:00). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.

BeginningOfYear ( this source ) : DateTimeOffset

Returns the first day of the current year with the time value set to 12:00:00 midnight (00:00:00).

Change ( this source, int years = null, int months = null, int days = null, int hours = null, int minutes = null, int seconds = null, int milliseconds = null ) : DateTimeOffset

Returns a new System.DateTimeOffset that change the provided parameters (years, months, days, hours, minutes, seconds, milliseconds) value/s.

EndOfDay ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset with the time value set to (23:59:59).

EndOfMonth ( this source ) : DateTimeOffset

Returns the last day of the current month with the time value set to (23:59:59).

EndOfQuarter ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset representing the end of the current quarter (last day of March, June, September, December) with the time value set to (23:59:59).

EndOfWeek ( this source ) : DateTimeOffset

Returns the last day of the current week with the time value set to (23:59:59). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.

EndOfYear ( this source ) : DateTimeOffset

Returns the last day of the current year with the time value set to (23:59:59).

IsFuture ( this source ) : bool

Returns true if the instance System.DateTimeOffset is greater than System.DateTimeOffset.Now, otherwise false.

IsPast ( this source ) : bool

Returns true if the instance System.DateTimeOffset is less than System.DateTimeOffset.Now, otherwise false.

Midnight ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset with the time value set to 12:00:00 midnight (00:00:00).

NextMonth ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that adds one month to the value of this instance.

NextWeek ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that adds seven days to the value of this instance with the time value set to 12:00:00 midnight (00:00:00).

NextWeek ( this source, DayOfWeek day ) : DateTimeOffset

Returns the given day of next week with the time value set to 12:00:00 midnight (00:00:00). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.

NextYear ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that adds one year to the value of this instance.

PreviousMonth ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that minus one month to the value of this instance.

PreviousYear ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that minus one year to the value of this instance.

Tomorrow ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that adds one day to the value of this instance.

Yesterday ( this source ) : DateTimeOffset

Returns a new System.DateTimeOffset that minus one day to the value of this instance.

Method Details

Advance() public static method

Returns a new System.DateTimeOffset that adds the provided parameters (years, months, days, hours, minutes, seconds) value/s.
public static Advance ( this source, int years, int months, int days, int hours, int minutes, int seconds ) : DateTimeOffset
source this instance.
years int The number of years to add.
months int The number of months to add.
days int The number of days to add.
hours int The number of hours to add.
minutes int The number of minutes to add.
seconds int The number of seconds to add.
return DateTimeOffset

Ago() public static method

Returns a new System.DateTimeOffset that minus the provided parameters (years, months, days, hours, minutes, seconds) value/s.
public static Ago ( this source, int years, int months, int days, int hours, int minutes, int seconds ) : DateTimeOffset
source this instance.
years int The number of years to reduce.
months int The number of months to reduce.
days int The number of days to reduce.
hours int The number of hours to reduce.
minutes int The number of minutes to reduce.
seconds int The number of seconds to reduce.
return DateTimeOffset

BeginningOfDay() public static method

Returns a new System.DateTimeOffset with the time value set to 12:00:00 midnight (00:00:00).
public static BeginningOfDay ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

BeginningOfMonth() public static method

Returns the first day of the current month with the time value set to 12:00:00 midnight (00:00:00).
public static BeginningOfMonth ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

BeginningOfQuarter() public static method

Returns a new System.DateTimeOffset representing the start of the current quarter (1st of January, April, July, October) with the time value set to 12:00:00 midnight (00:00:00).
public static BeginningOfQuarter ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

BeginningOfWeek() public static method

Returns the first day of the current week with the time value set to 12:00:00 midnight (00:00:00). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.
public static BeginningOfWeek ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

BeginningOfYear() public static method

Returns the first day of the current year with the time value set to 12:00:00 midnight (00:00:00).
public static BeginningOfYear ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

Change() public static method

Returns a new System.DateTimeOffset that change the provided parameters (years, months, days, hours, minutes, seconds, milliseconds) value/s.
public static Change ( this source, int years = null, int months = null, int days = null, int hours = null, int minutes = null, int seconds = null, int milliseconds = null ) : DateTimeOffset
source this instance.
years int The number of years to change.
months int The number of months to change.
days int The number of days to change.
hours int The number of hours to change.
minutes int The number of minutes to change.
seconds int The number of seconds to change.
milliseconds int The number of milliseconds to change.
return DateTimeOffset

EndOfDay() public static method

Returns a new System.DateTimeOffset with the time value set to (23:59:59).
public static EndOfDay ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

EndOfMonth() public static method

Returns the last day of the current month with the time value set to (23:59:59).
public static EndOfMonth ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

EndOfQuarter() public static method

Returns a new System.DateTimeOffset representing the end of the current quarter (last day of March, June, September, December) with the time value set to (23:59:59).
public static EndOfQuarter ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

EndOfWeek() public static method

Returns the last day of the current week with the time value set to (23:59:59). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.
public static EndOfWeek ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

EndOfYear() public static method

Returns the last day of the current year with the time value set to (23:59:59).
public static EndOfYear ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

IsFuture() public static method

Returns true if the instance System.DateTimeOffset is greater than System.DateTimeOffset.Now, otherwise false.
public static IsFuture ( this source ) : bool
source this instance.
return bool

IsPast() public static method

Returns true if the instance System.DateTimeOffset is less than System.DateTimeOffset.Now, otherwise false.
public static IsPast ( this source ) : bool
source this instance.
return bool

Midnight() public static method

Returns a new System.DateTimeOffset with the time value set to 12:00:00 midnight (00:00:00).
public static Midnight ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

NextMonth() public static method

Returns a new System.DateTimeOffset that adds one month to the value of this instance.
public static NextMonth ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

NextWeek() public static method

Returns a new System.DateTimeOffset that adds seven days to the value of this instance with the time value set to 12:00:00 midnight (00:00:00).
public static NextWeek ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

NextWeek() public static method

Returns the given day of next week with the time value set to 12:00:00 midnight (00:00:00). This method is culture-aware method which calculates based on System.Globalization.DateTimeFormatInfo.FirstDayOfWeek.
public static NextWeek ( this source, DayOfWeek day ) : DateTimeOffset
source this instance.
day DayOfWeek The of next week.
return DateTimeOffset

NextYear() public static method

Returns a new System.DateTimeOffset that adds one year to the value of this instance.
public static NextYear ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

PreviousMonth() public static method

Returns a new System.DateTimeOffset that minus one month to the value of this instance.
public static PreviousMonth ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

PreviousYear() public static method

Returns a new System.DateTimeOffset that minus one year to the value of this instance.
public static PreviousYear ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

Tomorrow() public static method

Returns a new System.DateTimeOffset that adds one day to the value of this instance.
public static Tomorrow ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset

Yesterday() public static method

Returns a new System.DateTimeOffset that minus one day to the value of this instance.
public static Yesterday ( this source ) : DateTimeOffset
source this instance.
return DateTimeOffset