Excel:转换mm / dd / yy hh:mm:ss Am / PM为dd / mm / yyy hh:mm:ss为24小时格式

时间:2018-04-12 07:38:05

标签: excel date spreadsheet datetime-format

我使用的是电子表格而不是微软的Excel。我需要帮助转换下面的格式,该格式应该可以在电子表格中使用以下公式

A1-TRUNC(A1) : to retrieve TIME for this.

8/16/2017 5:15:00 PM
to 
8/16/2017 17:15:00

我尝试使用格式选项,数据/文本到列/ MDY也使用了像

这样的公式
  

= SUBSTITUTE(SUBSTITUTE(A1,"的.pm"""),""":&#34) +(12/24)但没有帮助。

1 个答案:

答案 0 :(得分:0)

尝试在VBA模块中使用此功能:

Public Function showHours(myDate As Date)

ActiveCell.Value = Format(myDate, "mm/dd/yyyy hh:mm")

End Function

然后在例如,单元格A2中输入= showHours(A1)

相关问题