本文介绍了将部分文本字符串转换为时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从Excel工作表导入Access的数据。我遇到问题的领域叫做[SaleTime]。它包含物品称重的日期和时间。这个字符串是这样的:

20120314080253

我的查询中有两个字段。一个将第一部分转换为日期,另一个将第二部分转换为时间。它在Access中效果很好。


Weigh_Date:DateSerial(左([SaleTime],4),Mid([SaleTime],5,2),Mid([SaleTime],7, 2))


Weigh_Time:TimeSerial(右(左([SaleTime],10),2),右(左([SaleTime],12),2),右([ Saletime],2))

我的问题是当我在Excel中创建一个新表格的ODBC链接时,所有字段的时间显示为12:00:00 AM。 br />

我做错了什么?


非常感谢,Sharon

I have data that I import from an Excel sheet into Access. the field I have problems with is called [SaleTime]. It contains the date and time of the article being weighed. The string comes in like this:
20120314080253
I have two fields in my query. One converts the first part to a date and the other converts the second part to Time. It works great in Access.

Weigh_Date: DateSerial(Left([SaleTime],4),Mid([SaleTime],5,2),Mid([SaleTime],7,2))

Weigh_Time: TimeSerial(Right(Left([SaleTime],10),2),Right(Left([SaleTime],12),2),Right([Saletime],2))

My problem is when I create an ODBC link to a new sheet in Excel, the time shows as 12:00:00 AM in all the fields.

What am I doing wrong?

Thanks a lot, Sharon

推荐答案




这篇关于将部分文本字符串转换为时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 13:23