简体   繁体   English

如何将此日期文本转换为Excel中的日期字段?

[英]How do I convert this date text to a date field in excel?

I have a date that looks like this text. 我有一个看起来像这段文字的日期。 17-OCT-16 03.24.11.000000000 AM 2016年10月17日03.24.11.000000000 AM

I need to format that text into a date that I can then manipulate. 我需要将文本格式化为可以操纵的日期。 Ultimate I want to transform that time to millis from epoch but I'm not sure if that's even possible 终极,我想把那个时代从时代转变为毫秒,但我不确定那是否有可能

Its definitely possible, you can make use of DATEVALUE and TIMEVALUE function which convert a time or date in string format to date/time format: 绝对有可能,您可以使用DATEVALUE和TIMEVALUE函数将字符串格式的时间或日期转换为日期/时间格式:

=DATEVALUE(LEFT(A1,9)) + TIMEVALUE(SUBSTITUTE(MID(A1,11,8), ".", ":")&MID(A1, 19, 9))

This will give you a single number (42660.1417939815) in this case which is the number of days since 1/1/1900 (including milliseconds) 在这种情况下,这将为您提供一个数字(42660.1417939815),这是自1/1/1900以来的天数(包括毫秒)

It should just be some simple maths to get total milliseconds 获取总毫秒数应该只是一些简单的数学运算

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

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