Pip-Services-Commons-Dotnet
Static Public Member Functions | List of all members
PipServices3.Commons.Random.RandomDateTime Class Reference

Random generator for Date time values. More...

Static Public Member Functions

static DateTime NextDate (DateTime max)
 Generates a random DateTime in the range ['2000, 1, 1', 'maxYear']. This method generate dates without time(or time set to 00:00:00) More...
 
static DateTime NextDate (DateTime min, DateTime max)
 Generates a random DateTime in the range ['minYear', 'maxYear']. This method generate dates without time(or time set to 00:00:00) More...
 
static TimeSpan NextTime (long max)
 Generates a random TimeSpan in the range ['0', 'maxTime']. More...
 
static TimeSpan NextTime (long min, long max)
 Generates a random TimeSpan in the range ['minTime', 'maxTime']. More...
 
static DateTime NextDateTime (DateTime max)
 Generates a random DateTime and time in the range ['2000, 1, 1', 'maxYear']. This method generate dates without time(or time set to 00:00:00) More...
 
static DateTime NextDateTime (DateTime min, DateTime max)
 Generates a random DateTime and time in the range ['minYear', 'maxYear']. This method generate dates without time(or time set to 00:00:00) More...
 
static DateTime UpdateDateTime (DateTime value)
 Updates (drifts) a DateTime value. More...
 
static DateTime UpdateDateTime (DateTime value, long range)
 Updates (drifts) a ZonedDateTime value within specified range defined More...
 

Detailed Description

Random generator for Date time values.

var value1 = RandomDateTime.NextDate(2010, 0); // Possible result: 2008-01-03
var value2 = RandomDateTime.NextDateTime(2017, 0);// Possible result: 20017-03-11 11:20:32

Member Function Documentation

◆ NextDate() [1/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.NextDate ( DateTime  max)
static

Generates a random DateTime in the range ['2000, 1, 1', 'maxYear']. This method generate dates without time(or time set to 00:00:00)

Parameters
max
Returns

◆ NextDate() [2/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.NextDate ( DateTime  min,
DateTime  max 
)
static

Generates a random DateTime in the range ['minYear', 'maxYear']. This method generate dates without time(or time set to 00:00:00)

Parameters
min(optional) minimum range value
maxmax range value
Returns
a random DateTime value.

◆ NextDateTime() [1/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.NextDateTime ( DateTime  max)
static

Generates a random DateTime and time in the range ['2000, 1, 1', 'maxYear']. This method generate dates without time(or time set to 00:00:00)

Parameters
maxmax range value
Returns
a random DateTime value.

◆ NextDateTime() [2/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.NextDateTime ( DateTime  min,
DateTime  max 
)
static

Generates a random DateTime and time in the range ['minYear', 'maxYear']. This method generate dates without time(or time set to 00:00:00)

Parameters
minminimum range value
maxmax range value
Returns
a random DateTime value.

◆ NextTime() [1/2]

static TimeSpan PipServices3.Commons.Random.RandomDateTime.NextTime ( long  max)
static

Generates a random TimeSpan in the range ['0', 'maxTime'].

Parameters
maxmax range value
Returns
a random TimeSpan value.

◆ NextTime() [2/2]

static TimeSpan PipServices3.Commons.Random.RandomDateTime.NextTime ( long  min,
long  max 
)
static

Generates a random TimeSpan in the range ['minTime', 'maxTime'].

Parameters
minminimum range value
maxmax range value
Returns
a random TimeSpan value.

◆ UpdateDateTime() [1/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.UpdateDateTime ( DateTime  value)
static

Updates (drifts) a DateTime value.

Parameters
valuea DateTime value to drift.
Returns
an updated ZonedDateTime and time value.

◆ UpdateDateTime() [2/2]

static DateTime PipServices3.Commons.Random.RandomDateTime.UpdateDateTime ( DateTime  value,
long  range 
)
static

Updates (drifts) a ZonedDateTime value within specified range defined

Parameters
valuea DateTime value to drift.
range(optional) a range in milliseconds. Default: 10 days
Returns
an updated DateTime and time value.

The documentation for this class was generated from the following file: