This class is used to hold date and time information, along with precision and a timezone.

Note that the timezone conversions are based on the information in the local windows registry. This is not always correct in all circumstances, but patches usually exist where it is not.

Properties

string AsString;
   Returns the date and time as a string using the current locale value. This is primarily for debugging as the format is fixed to the host computer's format

string AsHL7;
   The date and time as a string using the standard HL7 format (yyyymmddhhnnss.zzzT)

string AsXML;
   The date and time as a string using the standard XML format (yyyy-mm-dd"T"hh:nn:ssT)

int Year;
   This is the year represented as an integer. It will include the century too.

int Month;
   This is the month represented as an integer.

int Day;
   This is the day represented as an integer.

int Hour;
   This is the hour represented as an integer.

int Minute;
   This is the Minute represented as an integer.

int Second;
   This is the seconds represented as an integer.

int NanoSecond;
   This is the number of nane seconds represented as an integer.

TDateAndTimePrecision Precision;
   The precision to which the date and time is specified

-- Enumeration of precision of the date/time

dtpYear

dtpMonth

dtpDay

dtpHour

dtpMin

dtpSec

dtpNanoSeconds

int FractionPrecision;
   The precision to which the fraction part of the time is specified

TDateAndTimeTimezone TimezoneType;
   The type of timezone

-- Enumeration of timezone types

dttzUnknown

dttzUTC

dttzLocal

dttzSpecified

int TzHour;
   Timezone hours

int TzMinute;
   timezone minutes


Methods

void ReadDate(string format, string date, bool AllowBlankTimes, bool allowNoDay, bool allownodate);
   Read a date (date) given the specified format. The specified format can be any combination of YYYY, YYY, YY, MM, MMM, DD, HH, NN, SS.

Use spaces for parts of the date that are just separators. This method can't cope with variable length date representations such as full month names. If the year is < 100, it will be adjusted to a current year (irrespective of the year length YYYY or YY). See ReadDateStric

void ReadDateStrict(string format, string date, bool AllowBlankTimes, bool allowNoDay, bool allownodate);
   Like ReadDate, but years < 100 will not be corrected as if they are 2 digit year representation

void IncrementMonth();
   Adds one to the current month, and if needed, will increment the year if needed

void IncrementYear();
   Adds one to the year

void IncrementWeekDay();
   Adds one to the day number, but if the new day falls on a Saturday or Sunday, it will be incremented until the day is Monday. If needed, the month and year may be changed to accomodate a month crossover.

void IncrementQuarter();
   Adds 3 to the month number.

void IncrementWeek();
   Adds 7 to the day number and corrects month and year as needed.

void IncrementDay();
   Adds one to the day number, and may update month and year as needed.

string FormatTimeStamp(string format);
   Returns the date and time in the format specified.

Valid formatting strings are

yyyy 4 digit year yy 2 digit year mmmm long month name mmm short month name mm 2 digit month number (will include leading 0 if needed) m month number (no leading 0) dd 2 digit day number (will include leading 0 if needed) d day number (no leading 0) hh 2 digit hour number nn 2 digit minutes ss 2 digit seconds

HL7Connect.Utils.DateAndTime AsLocal();
   This date and time in the local timezone of the computer

HL7Connect.Utils.DateAndTime AsUTC();
   this date and time in UTC time

HL7Connect.Utils.DateAndTime AsTz(int hr, int min);
   this date and time in the specified timezone.

bool Equals(HL7Connect.Utils.DateAndTime other);
   returns true if the timezone, precision, and actual instant are the same

bool SameTime(HL7Connect.Utils.DateAndTime other);
   returns true if the specified instant is the same allowing for specified precision - corrects for timezone


© Kestral Computing P/L 2000 - 2003. HL7Connect v2.00-063 generated on 30-Nov 2015.
Keywords: AsString, Equals, AsHL7, AsLocal, AsTz, AsUTC, AsXML, Day, FormatTimeStamp, FractionPrecision, Hour, IncrementDay, IncrementMonth, IncrementQuarter, IncrementWeek, IncrementWeekDay, IncrementYear, Minute, Month, NanoSecond, Precision, ReadDate, ReadDateStrict, SameTime, Second, TimezoneType, TzHour, TzMinute, Year, DateAndTime, HL7Connect.Utils.DateAndTime