久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何從當前時間戳獲取過去 24 小時?

How to get last 24 hours from current time-stamp?(如何從當前時間戳獲取過去 24 小時?)
本文介紹了如何從當前時間戳獲取過去 24 小時?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試提取過去 24 小時內的所有數據,但從當前時間開始.如果當前日期時間是 5/3,時間是 11:30,那么我想從 11:30 拉過去 24 小時.日期字段的數據類型是 datetime,它只有日期和時間值,沒有秒.這是我當前的查詢

I am trying to pull all data for the last 24 hours but starting from the current time. If the current date-time is 5/3 and the time is 11:30 then i want to pull the last 24 hours from 11:30. The data type for date field is datetime and it has only the date and time values without the seconds. Here is my current query

select Name, Location, myDate from myTable where myDate>= getdate()-24

上面的查詢給了我一切,但我只想要當前時間.這是表中 myDate 的樣子

the query above is giving me everything but i only want from the current time. this is how myDate look like in the table

 2015-03-05 10:30:00.000
2015-03-05 11:00:00.000
2015-03-05 11:30:00.000
2015-03-05 12:00:00.000
2015-03-05 12:30:00.000
2015-03-05 13:00:00.000
2015-03-05 13:30:00.000
2015-03-05 14:00:00.000
2015-03-05 14:30:00.000

推薦答案

為了更明確地表達您的意圖,您可能希望這樣編寫查詢:

To be more explicit with your intentions, you may want to write your query like so:

 select Name, Location, myDate from myTable where myDate>= DATEADD(hh, -24, GETDATE())

SQL Server DATEADD

這篇關于如何從當前時間戳獲取過去 24 小時?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 91视频网| 亚洲成人在线免费 | 久久久综合久久 | 日本在线视频不卡 | 91精品久久久久久久久久 | 精品久久一区 | 中文字幕高清在线 | 欧美一区2区三区4区公司二百 | 美女福利视频一区 | 国产精品视频999 | 久久人人网 | 婷婷激情综合 | 精品视频一区二区三区在线观看 | 日韩成人影院 | 一区二区三区中文字幕 | 日本久久www成人免 成人久久久久 | 国产色婷婷精品综合在线手机播放 | 亚洲综合无码一区二区 | 亚洲xx在线 | 色免费视频 | 伊人网影院 | 亚洲国产精品久久久 | 日韩在线看片 | 欧美一区二区三区久久精品 | 国产免费一区二区 | 精品国产一区二区三区久久久四川 | 黄色国产视频 | 久久aⅴ乱码一区二区三区 91综合网 | 久久99成人 | 黄视频免费观看 | 蜜桃av一区二区三区 | 国产精品精品视频一区二区三区 | 91免费看片 | 欧美视频在线观看 | 一二三四在线视频观看社区 | pacopacomama在线| 精品国产乱码久久久久久丨区2区 | 日日噜噜夜夜爽爽狠狠 | 操亚洲| 日韩在线视频网址 | 国产精品久久久久久久久久 |