简体   繁体   English

文本字符串的Excel日期格式

[英]Excel Date formatting from Text string

I have the following date formatted as text, which is retrieved from an external source, eg 我将以下日期设置为文本格式,该日期是从外部来源检索的,例如

September 9, 2017 12:05 PM BST BST 2017年9月9日下午12:05

I need to convert these text strings to a date format that I can use in calculations, but for the life of me I can get this to work using DateValue , Value , text to columns etc... 我需要将这些文本字符串转换为可以在计算中使用的日期格式,但是为了我的生命,我可以使用DateValueValue ,text to column等DateValue起作用。

Would prefer to do this via functions rather than programmatically - any assistance appreciated! 希望通过功能而不是通过编程方式进行操作-感谢您提供任何帮助!

= TEXT(LEFT(A1,FIND( “ ”A1)5),“ DD-MMM-YYYY”)

Try this formula, 试试这个公式,

=DATE(YEAR(TEXT(SUBSTITUTE(A1,"BST",""),"mm/dd/yyyy")),MONTH(TEXT(SUBSTITUTE(A1,"BST",""),"mm/dd/yyyy")),DAY(TEXT(SUBSTITUTE(A1,"BST",""),"mm/dd/yyyy")))

在此处输入图片说明

You can use the result in calculations. 您可以在计算中使用结果。

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

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