示例#1
0
        get(TimeZone tz)
        {
            DateTime time;

            switch (dbms_type)
            {
            case DBMS_TYPE_TIME:
                time = SqlDates.parseTime(value, true);
                time = time.ToLocalTime();
                break;

            case DBMS_TYPE_TMWO:
                /*
                ** Interpret as local time using requested or default timezone.
                */
                time = (tz != null) ? SqlDates.parseTime(value, tz)
                                                        : SqlDates.parseTime(value, false);
                break;

            case DBMS_TYPE_TMTZ:
                /*
                ** TIME WITH TIMEZONE values are local with
                ** explicit timezone offset.
                */
                time = SqlDates.parseTime(value, SqlDates.getTZ(timezone));
                time = time.ToLocalTime();
                break;

            default:       // should never happen since constructor checked
                throw SqlEx.get(ERR_GC401B_INVALID_DATE);
            }              // end switch

            if (nanos > 0)
            {
                TimeSpan span = new TimeSpan(nanos / 100L); // one tick = 100 nanos
                time += span;                               // add the nanos back in
            }

            return(time);
        }         // get
示例#2
0
        get(TimeZone tz)
        {
            DateTime ts;

            switch (dbms_type)
            {
            case DBMS_TYPE_TS:
                /*
                ** DAS formats local time using GMT.
                */
                ts = SqlDates.parseTimestamp(value, true);
                break;

            case DBMS_TYPE_TSWO:
                /*
                ** Interpret as local time in requested or default timezone.
                */
                ts = (tz != null) ? SqlDates.parseTimestamp(value, tz)
                                                          : SqlDates.parseTimestamp(value, false);
                break;

            case DBMS_TYPE_TSTZ:
                /*
                ** Apply explicit timezone.
                */
                ts = SqlDates.parseTimestamp(value, SqlDates.getTZ(timezone));
                break;

            default:                      // should never happen since constructor checked
                throw SqlEx.get(ERR_GC401B_INVALID_DATE);
            }

//			ts.setNanos(nanos);
            if (nanos > 0)
            {
                TimeSpan span = new TimeSpan(nanos / 100L); // one tick = 100 nanos
                ts += span;                                 // add the nanos back in
            }
            return(ts);
        }         // get