更改日期格式帮助 [英] Changing DATE Format HELP

查看:84
本文介绍了更改日期格式帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个技术日期问题对我来说真的很难,我有一个定制的问题。日期格式MM.DD.YY这实际上是从SAP提取的,他们没有提供其他格式选项,如ShortDate,LongDate等。所以现在我做一个必须将SAP日期转换为MS Access可识别的日期格式的SQL查询我使用ADO选择ShortDate MM / DD / YY。我在线阅读了关于使用ADO的Format()命令并对其进行了实验并希望我得到正确的结果。

I have a technical Date problem that''s really difficult for me, I have a "custom made" Date format MM.DD.YY this is actually extracted from SAP and theirs no other format option offered such as ShortDate, LongDate etc. so now I making a sql query that must convert SAP date to a date Format that is recognizable to MS Access and I choose the ShortDate MM/DD/YY using ADO. I read about the Format() command using ADO online and experiment on it and hoping I get something right.

展开 | 选择 | 换行 | 行号

推荐答案

你好Cephalon。为了避免陷入这种纠结,你需要更加系统地了解你想要做的事情。首先,您需要Access将其识别为日期的内容。为此,请从SAP获取当前日期字符串,并将''。''分隔符替换为已识别的''/''分隔符:
Hi Cephalon. To avoid getting into such a tangle you do need to be more systematic about what you are trying to do. Firstly, you need something that Access will recognise as a date. To do so, take the current date string from SAP and replace the ''.'' separators with the recognised ''/'' separators:
展开 | 选择 | 换行 | 行号


顺便说一下,虽然我更正了你的SQL语句的语法,但它不会为你做任何事情 - 没有任何用处。执行SQL语句时,您期望发生什么?您正在创建一个未随后使用的数据视图。它不会在您放置它的例程之外存在。


在我看来,您根本不需要使用代码。只需在Sheet1上使用Access查询,并添加计算字段即可提供新日期。


-Stewart
By the way, although I corrected the syntax of your SQL statement, as it stands it is not going to do anything for you - nothing useful at all. What do you expect to happen when you execute the SQL statement? You are creating a view of the data which is not subsequently being used. It does not persist outside of the routine in which you have placed it.

It seems to me that you do not need to use code at all. Just use an Access query on Sheet1 with the calculated field added to provide the new date.

-Stewart


Hi Stewart!


首先,谢谢你的帮助。我按照指示复制了您的代码并进行了一些更改。

Hi Stewart!

first of, thank you for the help. I copied your code as instructed and made some changes.

展开 | 选择 | Wrap | 行号


这篇关于更改日期格式帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆