且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Excel中的长日期字符串转换为可排序的日期/时间格式

更新时间:2023-02-12 22:16:13

如果格式一致,您也可以尝试以下方法:-

You could also try something like this, if the formats are consistent:-

=SUBSTITUTE(RIGHT(A1,LEN(A1)-SEARCH("day, ",A1)-4),",","")

至少根据尽管由于它是一个日期时间值,所以应该正确地作为一个列进行排序,但它确实会发出警告消息,因为Excel不知道是将其视为数字还是文本,因此,更好的答案是

Although this should sort correctly as a single column since it is a date-time value, it does give a warning message because Excel doesn't know whether to treat it as a number or text, so a better answer would be

=SUBSTITUTE(RIGHT(A1,LEN(A1)-SEARCH("day, ",A1)-4),",","")+0

然后,您可以使用任何所需的格式对其进行格式化,因此在英国,您可以选择以下自定义格式:-

You can then format it in whatever way you want, so in the UK you would choose the following custom format:-

dd/mm/yyyy hh:mm

结果

23/04/2015 09:19