跳到主要內容

如何在Excel中從日期中刪除時間?

有時,當您將數據導入Excel時,如果有一列帶有時間戳的日期,例如2/17/2012 12:23,並且您不想保留時間戳並希望刪除時間 12:23 從日期開始,僅離開日期 2/17/2012。 如何在Excel中的多個單元格中快速刪除日期中的時間?

使用格式單元格從日期中刪除時間

使用查找和替換功能從日期中刪除時間

使用VBA代碼從日期中刪除時間

從日期中刪除時間 Kutools for Excel的從日期功能中刪除時間(最佳) 好主意3


如果您想學習本教程,請下載示例電子表格。

doc樣本


使用格式單元格從日期中刪除時間

1.選擇要刪除時間的單元格,然後右鍵單擊以顯示上下文菜單,然後選擇 單元格格式。 看截圖:
doc從datetime 1刪除時間

2。 在裡面 單元格格式 對話框中選擇 日期 來自 類別 列表,然後根據需要在窗體右側部分選擇一種日期類型。 看截圖:
doc從datetime 2刪除時間

3。 點擊 OK,現在時間已從每個日期單元格中刪除。 看截圖:
doc從datetime 3刪除時間


從DateTime中刪除時間

在Excel中,要從12年11月31日1:21:2017中刪除12:11:31並將其精確地設置為1年21月2017日,您可能需要花一些時間來創建公式來處理此工作。 然而 從日期中刪除時間 的效用 Kutools for Excel 可以快速從Excel中的日期時間格式中永久刪除時間戳。 點擊下載 30-天免費試用.

文檔轉換日期-unix-1

使用查找和替換功能從日期中刪除時間

1.選擇要刪除時間的日期範圍。

2。 點擊 首頁 > 查找和選擇 > 更換查找和替換 對話框將會彈出。 參見screeenshot:

doc從date1刪除時間

3.然後輸入 空格星號*查找內容 框。 和 留著空白更換 框。

4。 點擊 “全部替換”。 並且所有時間戳都已在日期範圍內刪除。 看截圖:

doc從date2刪除時間

5.然後,您可以格式化範圍以僅顯示日期。


使用VBA代碼從日期中刪除時間

以下VBA代碼可以幫助您快速直接從日期中刪除時間戳。 進行如下操作:

1.選擇要刪除時間的範圍。

2。 點擊 開發者 >Visual Basic中 或按 Alt + F11鍵,一個新的 適用於應用程序的Microsoft Visual Basic 將顯示一個窗口,單擊 插入>模塊,然後將以下代碼輸入到模塊中:

VBA:從日期中刪除時間。

Sub ConvertDates()
'Updateby20140529
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    Rng.Value = VBA.Int(Rng.Value)
Next
WorkRng.NumberFormat = "mm/dd/yyyy"
End Sub

3。 然後點擊 文檔乘法計算 3 按鈕運行代碼。 然後會彈出一個對話框,用於選擇一個範圍以從日期中刪除時間。 看截圖:
doc從date7刪除時間

4。 點擊 OK,所有選擇的時間都已刪除,日期格式也已設置。
doc從date6刪除時間


從日期中刪除時間 Kutools for Excel的從日期功能中刪除時間(最佳)

其實,如果你有 Kutools for Excel -具有300多種功能的便捷工具,您可以應用它 從日期中刪除時間 可以快速直接從datetime單元格中刪除時間。

Kutools for Excel, 與以上 300 方便的功能,使您的工作更加輕鬆。 

免費安裝 Kutools for Excel,請執行以下操作:

1.選擇要放置日期的單元格,然後單擊 庫工具 > 公式助手公式助手。 看截圖:
doc kte從日期1刪除時間

2。 在裡面 公式助手 對話框中,選擇 日期 從下拉列表中選擇 公式類型,然後點擊 從日期中刪除時間選擇一個公式 部分,然後轉到 參數輸入 部分中,選擇要從中刪除時間的單元格。 看截圖:
doc kte從日期1刪除時間

3。 點擊 Ok,時間已從日期時間中刪除,然後將填充手柄拖動到您要根據需要應用此fomrula的單元格上,請參見屏幕截圖:
doc kutools從日期3刪除時間
doc kutools從日期4刪除時間


在Excel中快速輕鬆地將日期轉換為其他日期格式

套用日期格式 of Kutools for Excel 可以將標準日期快速轉換為所需的日期格式,例如僅顯示yyyy-mm-dd,yyyy.mm.dd等的月,日或年日期格式。 單擊以獲取全功能免費試用 30 天!
doc申請日期格式
 
Kutools for Excel:超過300個方便的Excel插件,免費試用,沒有限制 30 天。

相關文章:

如何在Excel中從日期中刪除年份?

如何在Excel中將多個日期更改為星期幾?

最佳辦公生產力工具

熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

增強您的 Excel 技能 Kutools for Excel,體驗前所未有的效率。 Kutools for Excel 提供 300 多種高級功能,可提高工作效率並節省時間。  點擊此處獲取您最需要的功能...

kte選項卡201905


Office Tab 為 Office 帶來選項卡式界面,讓您的工作更輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (32)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Just copy the columns and paste them in a txt file, the txt file will not show the hours and minutes. Copy the dates from the txt and paste it back to the xls file. pretty easy
This comment was minimized by the moderator on the site
Copy to a cell and format as general (MS Date Value), then ROUNDDOWN,0 Simple.
This comment was minimized by the moderator on the site
what i've noticed is that when you clean the "date" column, you will always get a standard Number comprised of 5 digits. Usually it something like 43xxx. If the cell contains a timestamp ( 09:40:33) , your number will be 43xxx.yyy, where .yyy contains the details of the Hours:minutes:seconds. What always works a treat for me is to eliminate what's after the "." . To do this, I simply use =left(clean(A1),5) , whereby A1 = cell with the date stamp :) hope this helps anyone.
This comment was minimized by the moderator on the site
This was so helpful and worked for my needs exactly! Thank you!
This comment was minimized by the moderator on the site
Thanks a lot! For me it worked. Is funny you can found better solutions in the comments section than in the actual post ;)
This comment was minimized by the moderator on the site
useful, thanks
This comment was minimized by the moderator on the site
thank you !!!
This comment was minimized by the moderator on the site
cara show de bola
muitissimo obrigado
This comment was minimized by the moderator on the site
Thanks you so much , for that replace option work,,thank you
This comment was minimized by the moderator on the site
Thank you! This helped me a great deal to make dates so that I can then create charts showing accurate trends in performance.
This comment was minimized by the moderator on the site
just use formula =int(date)
This comment was minimized by the moderator on the site
dropping the time with a global replace - GENIUS, dude (...or dudette).
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations