17 using System.Globalization;
27 #region class variables
28 private static CultureInfo _ci;
36 _ci =
new CultureInfo(
"en-US");
47 string val = (dt == null) ? String.Empty :
48 dt.Value.ToString(
"yyyy\\/MM\\/dd HH\\:mm\\:ss", CultureInfo.InvariantCulture);
68 DateTimeOffset dto = DateTimeOffset.FromUnixTimeSeconds(seconds);
69 dt = dto.DateTime.ToLocalTime();
73 catch (ArgumentOutOfRangeException ecx)
75 AcDebug.
Log($
"ArgumentOutOfRangeException caught and logged in AcDateTime.AcDate2DateTime{Environment.NewLine}{ecx.Message}");
89 bool result =
long.TryParse(seconds, out val);
102 return DateTime.TryParseExact(dt,
"yyyy\\/MM\\/dd HH\\:mm\\:ss", _ci, DateTimeStyles.None, out temp);
static DateTime AcDate2DateTime(string seconds)
Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time...
static AcDateTime()
Instantiate CultureInfo class variable.
Use to validate and convert date/time values to and from .NET and AccuRev/Unix formats.
static DateTime AcDate2DateTime(long seconds)
Convert an AccuRev date given in Unix time (seconds param) to a .NET DateTime in local time...
static void Log(string message, bool formatting=true)
Write the message text to STDOUT, to weekly log files located in %LOCALAPPDATA%\AcTools\Logs, and to trigger.log in the AccuRev server's ..storage\site_slice\logs folder in the case of triggers.
static string DateTime2AcDate(DateTime?dt)
Convert DateTime dt parameter to a string suitable for AccuRev command line processing.
Use to log and display error and general purpose text messages, and to save the XML param data sent b...
static bool AcDateValid(string dt)
Determine if dt parameter in AccuRev string format is a valid date and time.