简体   繁体   English

将文本日期格式转换为数字日期格式

[英]Convert text date format to number date format

I have stored some data entrys in a CSV file in following Format: 我已将某些数据条目以以下格式存储在CSV文件中:
Thu Jul 28 08:42:33 GMT+01:00 2016
and need to convert it to just a time stamp (eg. h:m:s ). 并且需要将其转换为时间戳(例如h:m:s )。 How can I quickly and easily do this? 如何快速轻松地做到这一点?

To convert a text date in a cell to a serial number, you use the DATEVALUE function. 要将单元格中的文本日期转换为序列号,请使用DATEVALUE函数。 Then you copy the formula, select the cells that contain the text dates, and use Paste Special to apply a date format to them. 然后,您复制公式,选择包含文本日期的单元格,然后使用“选择性粘贴”将日期格式应用于它们。 Select a blank cell and verify that its number format is General. 选择一个空白单元格,并验证其数字格式为常规。

If the size is fixed, then assuming the string is in A1: 如果大小是固定的,则假定字符串在A1中:

=MID(A1,12,8)

The result can then be converted to an actual time value using TIMEVALUE . 然后可以使用TIMEVALUE将结果转换为实际时间值。

看起来像对单个函数的简单调用将提取所需的子字符串,因为它以特定的偏移量开始,并且仅运行八个字符(两个hh加冒号加两个mm加冒号加两个ss)。

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

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