MssqlDateTimeConversion extension

The driver returns every date and time column as an MssqlDateTimeValue — year through nanosecond, plus an offset in minutes — because SQL Server's types each have their own packed layout and hand-decoding them produces plausible wrong answers rather than errors.

These convert to the Dart types a caller would rather have, and refuse when the conversion would lose something.

on
  • MssqlDateTimeValue

Methods

toDateTime({bool utc = false}) DateTime

Available on MssqlDateTimeValue, provided by the MssqlDateTimeConversion extension

This value as a DateTime.
toDuration() Duration

Available on MssqlDateTimeValue, provided by the MssqlDateTimeConversion extension

A time column as the offset from the start of the day.