在 MS Access 查询中将字符串转换为日期 [英] Convert String to Date in MS Access Query

查看:39
本文介绍了在 MS Access 查询中将字符串转换为日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据 Date 列从我的 access 表中检索数据.我的要求是显示大于特定值的所有内容.我正在尝试 cast 我的值,它是一个 string 使用格式 &CDate 函数和 datetime 数据类型它作为溢出抛出.

I am trying to retrieve data from my access table based on Date column. My requirement is to display everything greater than the certain value. I am trying to cast my value, which is a string using Format &CDate function with datetime data type and it throws out as Overflow.

这里是查询:

Select * from Events
Where Events.[Date] > cDate(Format("20130423014854","yyyy-MM-dd hh:mm:ss"))

表中的样本日期记录值:2013-04-23 13:48:54.0

Sample Date Record Value from Table : 2013-04-23 13:48:54.0

Events.[Date]access

我该如何解决这个问题?

How can I fix this ?

推荐答案

使用 DateValue() 函数将 string 转换为 date数据类型.这是最简单的方法.

Use the DateValue() function to convert a string to date data type. That's the easiest way of doing this.

DateValue(String Date) 

这篇关于在 MS Access 查询中将字符串转换为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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