Unit Converter Dialog: Special support for DateTime/Numeric values in RiverWare 7.1
Phil Weinstein, David Neumann, Edie Zagona, CADSWES, 6-07-2017, minor revision 6-08.
Document Home: R:\doc\units\2017\UnitConverter-DateTimeNumerics.docx
Funding: Truckee/BOR LBAO, Subtask 1.3: Datetime Unit Type Enhancements: Improve the usability of RiverWare's Datetime unit type and its interaction with other software tools.
The RiverWare Unit Converter dialog, used for converting a single numeric value into different units of the value's unit type (e.g. "Flow") now has special support for the DateTime unit-type. Instead of converting a DateTime value to a different DateTime unit (which isn't meaningful in the way it is for typical numeric values), this dialog now supports conversions between the natural (text) representation of a DateTime value and its internal numeric value (encoded as a double-precision floating point number).
![]() |
When DateTime is the selected unit type, a completely different set of GUI controls is shown. First, the user chooses which direction to do the conversion by selecting one of these two radio buttons:
In the DateTime to Numeric Value direction, the user selects the DateTime unit (one of which is FullDateTime -- fully specified absolute date/times). The selected unit determines which GUI input controls are presented according to the relevant parts of a DateTime value. In the FullDateTime case, an additional checkbox switches between a conventional DateTime spinner (with a timestep size matching the current run configuration) and individual date/time-part input controls.
In the Numeric Value to DateTime direction, the user just enters a numeric value, and both the DateTime unit and value are displayed for that value.
In both modes, the result is automatically computed as the user modifies the inputs. The text of the result is selectable and copyable from the result field.
RiverWare currently supports the following units for the DateTime unit type:
RiverWare DateTime numeric value encoding.
One of RiverWare's internal representations of DateTime values is a double-precision floating point number (the same as ordinary numeric values). The integer part is the number of seconds since the beginning of 1800 (or, as RiverWare presents this, December 31, 1799, 24:00). For ordinary FullDateTimes, the fractional part is zero. Otherwise, six fractional binary digits (bits) are used to indicate which parts of that seconds count are relevant (with reverse sense: 0 means relevant): Year, Month, Day, Hour, Minutes, and Seconds. In DateTime units other than FullDateTime and Year, the canonical seconds-count represents a moment within the year 1804 (the first leap year after the zero-DateTime). Note that the six fractional binary digits require up to six fractional decimal digits. (Six decimal fractional digits is sufficient).
--- (end) ---