在Excel中输入日期和时间

In yesterday's post I showed formulas you can use to pull information from a date in Excel. In some workbooks you'll enter dates manually, but often you'd like a date to be calculated automatically.

在昨天的帖子中,我展示了可用于从Excel中的日期提取信息的公式。 在某些工作簿中,您将手动输入日期,但是通常您希望自动计算日期。

计算当前日期 (Calculate the Current Date)

To show the current date in a cell, use the TODAY function:

要显示单元格中的当前日期,请使用TODAY函数:

=TODAY()

= TODAY()

This date will update automatically when you open the workbook on a different date.

当您在其他日期打开工作簿时,此日期将自动更新。

计算当前日期和时间 (Calculate the Current Date and Time)

To show the current date and time in a cell, use the NOW function:

要显示单元格中的当前日期和时间,请使用NOW函数:

=NOW()

=现在()

This will update automatically.

这将自动更新。

手动输入当前日期和时间 (Manually Enter the Current Date and Time)

Instead of formulas, you can enter the date and time as values. These will NOT update automatically.

代替公式,您可以输入日期和时间作为值。 这些不会自动更新。

  • To enter the current date in a cell as a value, press the Ctrl key and type a semi-colon (Ctrl+;)

    要将当前日期输入到单元格中作为值,请按Ctrl键并输入分号(Ctrl +;)。
  • To enter the current time in a cell as a value, press the Ctrl key and type a colon (Ctrl+Shift+;)

    要将当前时间作为值输入到单元格中,请按Ctrl键并键入冒号(Ctrl + Shift +;)。
  • To enter both the date and time as value, enter the date (Ctrl+;), then a space character, then the time (Ctrl+Shift+;)

    要同时输入日期和时间作为值,请输入日期(Ctrl +;),然后输入空格字符,然后输入时间(Ctrl + Shift +;)。

确定上次保存工作簿的时间 (Determine When the Workbook Was Last Saved)

In yesterday's post on dates, Mariusz asked how to find the date that the workbook was last saved. Unlike Word, excel doesn't have a menu command that will insert the last saved date.

在昨天的日期发布中,马吕斯(Mariusz)询问如何找到工作簿的最后保存日期 。 与Word不同,excel没有菜单命令可插入上次保存的日期。

However, you can use a bit of programming to insert the date, assuming the workbook has been saved.

但是,假设工作簿已保存,则可以使用一些编程来插入日期。

Sub GetLastSavedDate() On Error Resume Next Dim sSaveDate As String sSaveDate = FileDateTime(ActiveWorkbook.FullName) If sSaveDate = "" Then MsgBox "Could not determine save date." Else Worksheets("DataEntry").Range("A1").Value _ = "Last Saved: " & sSaveDate End If End Sub

子GetLastSavedDate()错误恢复下一个昏暗的sSaveDate为字符串sSaveDate = FileDateTime(ActiveWorkbook.FullName)如果sSaveDate =“”则MsgBox“无法确定保存日期。” 其他工作表(“ DataEntry”)。范围(“ A1”)。值_ =“上次保存:”&sSaveDate如果结束则结束

翻译自: https://contexturesblog.com/archives/2008/11/20/entering-dates-and-times-in-excel/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值