-1

I'm using SQL Server 2019 Express. How can I get a date and time column to NOT show fractional seconds? The only choices in the drop-down are datetime, datetime2 and datetime2(7). If I edit the 7 to a 0, it still shows fractional seconds.

I'll handle this another way since no one seems to have an answer to my question.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
John
  • 1
  • 1
  • 2
    Does this answer your question? [How to return only the Date from a SQL Server DateTime datatype](https://stackoverflow.com/questions/113045/how-to-return-only-the-date-from-a-sql-server-datetime-datatype), this this comment: https://stackoverflow.com/a/126984/724039 – Luuk Sep 03 '22 at 14:39
  • 4
    This sounds like the problem is how you choose to *display* the value, not the data type itself. – Thom A Sep 03 '22 at 14:54
  • 3
    Shouldn't you solve this problem in the front-end by choosing an appropriate format? – Olivier Jacot-Descombes Sep 03 '22 at 15:00

1 Answers1

0

Can you use the convert in your queries? If yes, using atetime2(0) will do the trick

select CONVERT(DATETIME2(0), DateCreated)  from apps
select CONVERT(DATETIME2(0), GETDATE())  from apps