DateTime display formats
Posted: Wed 08 Mar 2017 18:20
Under Tools / Options / Data Editor / Formatting there are a number of predefined format strings for 3 different data types: Date, DateTime, and Floating point numbers. It's good that we can change the format string if a custom format is wanted. Of which I have done for displaying microseconds for the DateTime type.
Unless I am doing something incorrect, when a format string in chosen, that format appears to apply to all like data types when being displayed in any Data Editor (example many results grids from different SQL statements). My question is why isn't the precision determined from the column data type?
According to BOL, the precision of SmallDateTime is 1 minute with typical rounding rules. DateTime the precision is microseconds with unique rounding rules. DateTime2 the default precision is 100 nanoseconds or 10 to the power of -7. In addition, the precision of fractional seconds for DateTime2 can be specified by the user. In addition, if the user does a CAST or CONVERT to a specific precision for a DateTime type in a SELECT, that one-format-fits-all for DateTime is applied when displayed.
Is this as designed? Am I doing something wrong? Or is this on the bug list to be fixed at a later date?
Unless I am doing something incorrect, when a format string in chosen, that format appears to apply to all like data types when being displayed in any Data Editor (example many results grids from different SQL statements). My question is why isn't the precision determined from the column data type?
According to BOL, the precision of SmallDateTime is 1 minute with typical rounding rules. DateTime the precision is microseconds with unique rounding rules. DateTime2 the default precision is 100 nanoseconds or 10 to the power of -7. In addition, the precision of fractional seconds for DateTime2 can be specified by the user. In addition, if the user does a CAST or CONVERT to a specific precision for a DateTime type in a SELECT, that one-format-fits-all for DateTime is applied when displayed.
Is this as designed? Am I doing something wrong? Or is this on the bug list to be fixed at a later date?