AcUtils
A high performance abstraction layer for AccuRev
Static Public Member Functions | Static Private Member Functions | List of all members
AcUtils.AcDateTime Class Reference

Use to validate and convert date/time values to and from .NET and AccuRev/Unix formats. More...

Static Public Member Functions

static string DateTime2AcDate (DateTime?dt)
 Convert DateTime dt parameter to a string suitable for AccuRev command line processing. More...
 
static DateTime AcDate2DateTime (long seconds)
 Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time. More...
 
static DateTime AcDate2DateTime (string seconds)
 Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time. More...
 
static bool AcDateValid (string dt)
 Determine if dt parameter in AccuRev string format is a valid date and time. More...
 

Static Private Member Functions

static AcDateTime ()
 Instantiate CultureInfo class variable. More...
 

Detailed Description

Use to validate and convert date/time values to and from .NET and AccuRev/Unix formats.

Definition at line 25 of file AcDateTime.cs.

Constructor & Destructor Documentation

static AcUtils.AcDateTime.AcDateTime ( )
inlinestaticprivate

Instantiate CultureInfo class variable.

Definition at line 34 of file AcDateTime.cs.

Member Function Documentation

static DateTime AcUtils.AcDateTime.AcDate2DateTime ( long  seconds)
inlinestatic

Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time.

Parameters
secondsUnix time expressed as the number of seconds since January 1, 1970 UTC.
Returns
DateTime object with the converted value or null on error or seconds equal zero (0).
Exceptions
ArgumentOutOfRangeExceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on failure to convert seconds to a date and time value that represents the same moment in time as the Unix time.
See also
LatestPromotions.cs

Definition at line 61 of file AcDateTime.cs.

Referenced by AcUtils.AcDateTime.AcDate2DateTime(), and AcUtils.Extensions.acxTime().

static DateTime AcUtils.AcDateTime.AcDate2DateTime ( string  seconds)
inlinestatic

Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time.

Parameters
secondsUnix time expressed as the number of seconds since January 1, 1970 UTC.
Returns
DateTime object with the converted value or null on error.

Definition at line 86 of file AcDateTime.cs.

static bool AcUtils.AcDateTime.AcDateValid ( string  dt)
inlinestatic

Determine if dt parameter in AccuRev string format is a valid date and time.

Parameters
dtThe date and time in AccuRev string format yyyy/mm/dd hh:mm:ss.
Returns
true if dt is a valid date and time, false otherwise.
See also
LatestPromotions.cs

Definition at line 99 of file AcDateTime.cs.

static string AcUtils.AcDateTime.DateTime2AcDate ( DateTime?  dt)
inlinestatic

Convert DateTime dt parameter to a string suitable for AccuRev command line processing.

Parameters
dtThe DateTime object to convert.
Returns
A string in yyyy/mm/dd hh:mm:ss format or an empty string if dt is null.
See also
LatestPromotions.cs

Definition at line 45 of file AcDateTime.cs.