C# Class PRI.ProductivityExtensions.TemporalExtensions.Temporalable

显示文件 Open project: peteraritchie/ProductivityExtensions

Public Methods

Method Description
Ago ( this source ) : System.DateTime

Creates a final DateTime source in the past 50.Seconds.Ago();

BeginningOfDay ( this date ) : System.DateTime

Gets a DateTime that represents the first millisecond of the day represented by date

Days ( this source ) : System.TimeSpan

Creates a TimeSpan spanning source days. var oneDay = 1.Days();

Double ( this source ) : System.TimeSpan

Doubles a TimeSpan

EndOfDay ( this date ) : System.DateTime

Gets a DateTime that represents the last millisecond of the day represented by date

From ( this source, System.DateTime origin ) : System.DateTime

Calculates a final date spanning source after origin // calculate date/time that it will be in one hour var finalDate = new TimeSpan(0, 1, 0, 0).From(DateTime.Now);

Hours ( this source ) : System.TimeSpan

Creates a TimeSpan spanning source hours. var oneHour = 1.Hours();

Milliseconds ( this source ) : System.TimeSpan

Creates a TimeSpan spanning source milliseconds. var fiftyMilliseconds = 50.Milliseconds();

Minutes ( this source ) : System.TimeSpan

Creates a TimeSpan spanning source minutes. var oneMinute = 1.Minutes();

RoundToHours ( this timeSpan ) : System.TimeSpan

Rounds a TimeSpan to the nearest hour

RoundToMinutes ( this timeSpan ) : System.TimeSpan

Rounds a TimeSpan to the nearest minute

RoundToSeconds ( this timeSpan ) : System.TimeSpan

Rounds a TimeSpan to the nearest second

Second ( this source ) : System.TimeSpan

Creates a TimeSpan spanning 1 second. var oneSecond = 1.Second();

Seconds ( this source ) : System.TimeSpan

Creates a TimeSpan spanning source seconds. var fiveSeconds = 5.Second();

Since ( this source, System.DateTime origin ) : System.DateTime

Calculates a final date spanning source after origin Alias to From

ToEnglishString ( this timeSpan ) : string

Creates an English string from a TimeSpan value

Private Methods

Method Description
Million ( this value ) : int
Months ( this source ) : System.TimeSpan
Thousand ( this value ) : int
Years ( this source ) : System.TimeSpan

Method Details

Ago() public static method

Creates a final DateTime source in the past 50.Seconds.Ago();
public static Ago ( this source ) : System.DateTime
source this
return System.DateTime

BeginningOfDay() public static method

Gets a DateTime that represents the first millisecond of the day represented by date
public static BeginningOfDay ( this date ) : System.DateTime
date this
return System.DateTime

Days() public static method

Creates a TimeSpan spanning source days. var oneDay = 1.Days();
public static Days ( this source ) : System.TimeSpan
source this
return System.TimeSpan

Double() public static method

Doubles a TimeSpan
public static Double ( this source ) : System.TimeSpan
source this
return System.TimeSpan

EndOfDay() public static method

Gets a DateTime that represents the last millisecond of the day represented by date
public static EndOfDay ( this date ) : System.DateTime
date this
return System.DateTime

From() public static method

Calculates a final date spanning source after origin // calculate date/time that it will be in one hour var finalDate = new TimeSpan(0, 1, 0, 0).From(DateTime.Now);
public static From ( this source, System.DateTime origin ) : System.DateTime
source this
origin System.DateTime
return System.DateTime

Hours() public static method

Creates a TimeSpan spanning source hours. var oneHour = 1.Hours();
public static Hours ( this source ) : System.TimeSpan
source this
return System.TimeSpan

Milliseconds() public static method

Creates a TimeSpan spanning source milliseconds. var fiftyMilliseconds = 50.Milliseconds();
public static Milliseconds ( this source ) : System.TimeSpan
source this
return System.TimeSpan

Minutes() public static method

Creates a TimeSpan spanning source minutes. var oneMinute = 1.Minutes();
public static Minutes ( this source ) : System.TimeSpan
source this
return System.TimeSpan

RoundToHours() public static method

Rounds a TimeSpan to the nearest hour
public static RoundToHours ( this timeSpan ) : System.TimeSpan
timeSpan this
return System.TimeSpan

RoundToMinutes() public static method

Rounds a TimeSpan to the nearest minute
public static RoundToMinutes ( this timeSpan ) : System.TimeSpan
timeSpan this
return System.TimeSpan

RoundToSeconds() public static method

Rounds a TimeSpan to the nearest second
public static RoundToSeconds ( this timeSpan ) : System.TimeSpan
timeSpan this
return System.TimeSpan

Second() public static method

Creates a TimeSpan spanning 1 second. var oneSecond = 1.Second();
public static Second ( this source ) : System.TimeSpan
source this
return System.TimeSpan

Seconds() public static method

Creates a TimeSpan spanning source seconds. var fiveSeconds = 5.Second();
public static Seconds ( this source ) : System.TimeSpan
source this
return System.TimeSpan

Since() public static method

Calculates a final date spanning source after origin Alias to From
public static Since ( this source, System.DateTime origin ) : System.DateTime
source this
origin System.DateTime
return System.DateTime

ToEnglishString() public static method

Creates an English string from a TimeSpan value
public static ToEnglishString ( this timeSpan ) : string
timeSpan this
return string