将时间转换为其他格式

时间:2019-06-27 13:29:01

标签: sql sql-server

我需要协助将秒转换为更易读的格式,因此需要帮助。

例如,如果我的列给出以下输出(以秒为单位):

                         156
                         253
                          20
                          85
                          95
                         252

我需要将其变成这样:

                        02:36
                        04:13
                        00:20
                        01:25
                        01:35
                        04:12 

我的查询产生以下输出:

datediff([second], (Select TOP 1 [ActualStart] 
                   from Runtime_CTE 
                   where HelperObjectID = [Report ID] ORDER BY ActualStart DESC), 
          [Previous Run]) as [Run Time]

有人可以帮助我更新查询吗?

谢谢。

1 个答案:

答案 0 :(得分:6)

将值添加到午夜时间:

public class DealAdapter extends RecyclerView.Adapter<DealAdapter.DealViewHolder>{
    ArrayList<TravelDeal> deals;
    private FirebaseDatabase mFirebaseDatabase;
    private DatabaseReference mDatabaseReference;
    private ChildEventListener mChildlistener;
    public DealAdapter(){
        FirebaseUtil.openFbReference("traveluganda",this);//problem is here...on the 2nd argument.
        mFirebaseDatabase = FirebaseUtil.mFirebaseDatabase;
        mDatabaseReference = FirebaseUtil.mDatabaseReference;
        deals = FirebaseUtil.mDeals;
        mChildlistener = new ChildEventListener() {

例如,值SELECT DATEADD(SECOND, YourColumn, CONVERT(time(0), '00:00')) AS TimeValue FROM YourTable... 返回156

00:02:36