简体   繁体   English

Excel:以毫秒为单位的文本到日期的转换

[英]Excel : Text to date conversion with milliseconds

I am trying to convert a datetime string such as 2015-11-01-02.02.38.444000 to Datetime format in Excel. 我正在尝试将Excel 2015等datetime字符串转换为Datetime格式,例如2015-11-01-02.02.38.444000。 I have tried solutions provided in previous questions, but this particular format was not covered. 我已经尝试了先前问题中提供的解决方案,但是没有涵盖此特定格式。 I am looking to have both date and time in the same cell. 我希望在同一单元格中同时包含日期和时间。 Please assist. 请协助。

It depends how consistent the strings are, but for this particular one you could try 这取决于字符串的一致性,但是对于这一特定字符串,您可以尝试

=VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-"," ",3),".",":",1),".",":",1))

then use custom formatting to show it as a datetime value with milliseconds 然后使用自定义格式将其显示为以毫秒为单位的日期时间值

dd/mm/yyyy hh:mm:ss.000

(you may have to change this for your locale). (您可能需要针对您的语言环境进行更改)。

BTW to make the TIMEVALUE formula in your comment work you would have to change the first two decimal points to colons. 顺便说一句,要使TIMEVALUE公式在注释中起作用,您必须将前两个小数点更改为冒号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM