[英]Convert text field to Date/time field ms access query
Hi guys can i ask if it's possible to convert a text field to a date/time field? 大家好,我可以问一下是否可以将文本字段转换为日期/时间字段吗?
for example i have a field called Month and the field is a short text data type. 例如,我有一个名为Month的字段,并且该字段是短文本数据类型。
Here is an example: 这是一个例子:
Month 月
Sep 2016 2016年9月
Nov 2016 2016年11月
Dec 2016 2016年12月
is it possible that i could convert this one to a date time? 我有可能将其转换为日期时间吗?
Try this 尝试这个
DateValue("1 " & Month)
I'm assuming you want to put the first of the month in the date. 我假设您要在日期中输入月份的第一天。
Output should be 输出应为
9/1/2016
11/1/2016
12/1/2016
in your case 在你的情况下
SELECT convert(datetime,'Oct 2015',10月0)或SELECT convert(datetime,'Oct 2015',0)或SELECT convert(datetime,'Oct 2015',0)
It's so easy that it can't be simpler: 它是如此简单以至于无法简单:
FirstOfMonth: CDate([Month])
The values will be primo of [Month]. 这些值将是[Month]的原始值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.