timestamp and datetime

后端 未结 3 732
孤街浪徒
孤街浪徒 2021-01-18 08:29

i have a table with two columns first column is a (currentdate)timestamp and the other one is a (dateReturn)datetime column.i i need to get the difference between currentdat

3条回答
  •  [愿得一人]
    2021-01-18 08:48

    If your column has the (relatively rare) timestamp type, Lasse V. Karlsen's answer is right.

    If both columns have the datetime type, you can:

    select  datediff(day, dateReturn, currentdate)
    from    YourTable
    

    See the datediff function.

提交回复
热议问题