예제 #1
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate date2 = new TdrDate();

            if (date2.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { date2.nYear, date2.bMon, date2.bDay };
                return(buf.sprintf("{0:d4}-{1:d2}-{2:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE);
        }
예제 #2
0
        public static TdrError.ErrorType str2TdrDate(out uint date, string strDate)
        {
            DateTime time;

            TdrError.ErrorType type  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            date2 = new TdrDate();

            if (DateTime.TryParse(strDate, out time))
            {
                date2.nYear = (short)time.Year;
                date2.bMon  = (byte)time.Month;
                date2.bDay  = (byte)time.Day;
                date2.toDate(out date);
                return(type);
            }
            date = 0;
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE);
        }
예제 #3
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate tdrDate = new TdrDate();

            TdrError.ErrorType result;
            if (tdrDate.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d4}-{1:d2}-{2:d2}", new object[]
                {
                    tdrDate.nYear,
                    tdrDate.bMon,
                    tdrDate.bDay
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }
            return(result);
        }
예제 #4
0
        public static TdrError.ErrorType str2TdrDate(out uint date, string strDate)
        {
            TdrError.ErrorType result  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            tdrDate = new TdrDate();
            DateTime           dateTime;

            if (DateTime.TryParse(strDate, ref dateTime))
            {
                tdrDate.nYear = (short)dateTime.get_Year();
                tdrDate.bMon  = (byte)dateTime.get_Month();
                tdrDate.bDay  = (byte)dateTime.get_Day();
                tdrDate.toDate(out date);
            }
            else
            {
                date   = 0u;
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }
            return(result);
        }
예제 #5
0
 public TdrDateTime(ulong datetime)
 {
     this.tdrDate = new TdrDate((uint)(datetime & (ulong)-1));
     this.tdrTime = new TdrTime((uint)(datetime >> 32 & (ulong)-1));
 }
예제 #6
0
 public TdrDateTime()
 {
     this.tdrDate = new TdrDate();
     this.tdrTime = new TdrTime();
 }
예제 #7
0
 public TdrDateTime(ulong datetime)
 {
     this.tdrDate = new TdrDate((uint)(datetime & 0xffffffffL));
     this.tdrTime = new TdrTime((uint)((datetime >> 0x20) & 0xffffffffL));
 }