Convert a timestamp into excel readable format?

时间:2016-03-04 17:57:18

标签: excel-formula

I am trying to convert a column in my excel sheet which has the value like: Jan 31 2016 11:41PM, I need to convert it into excel readable format like: 1/31/2016 11:41:00 PM.

I tried to convert by reformatting the column in excel and several other alternatives but doesn't work.

Please help! Thanks.

2 个答案:

答案 0 :(得分:1)

使用此:

=--SUBSTITUTE(SUBSTITUTE(TRIM(MID(A1,FIND(" ",A1),FIND("}}}",(SUBSTITUTE(A1," ","}}}",2)))-FIND(" ",A1))) &" " & LEFT(A1,3) & MID(A1,FIND("}}}",(SUBSTITUTE(A1," ","}}}",2))),LEN(A1)),"P"," P"),"A", " A")

enter image description here

然后使用自定义格式:

mm/dd/yyyy hh:mm:ss AM/PM

enter image description here

你得到一个伪装成日期时间的号码:

enter image description here

答案 1 :(得分:0)

试试这个

=--SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"PM"," PM"),"AM"," AM")," ",", ",2)

输出是日期时间值。

然后根据自己的喜好使用数字格式对其进行格式化。

  

这是公式的细分视图   enter image description here