Access 数据库杂记
最近在做一个项目,数据库需要用到 Access,平时****惯了 MYSQL、SQL server 数据库,用起 Access 数据库还是
End Function
3、SQL 系列数据库 Case 或者 Convert 函数在 Access 中不支持
用一个字段(takeDate)来存储日期时间,现在需要在查询语句中格式化显示时间。
在 Access 数据库中可以用 format 函数格式化。
Format 函数原型
Format[$] ( expr [ , fmt ] )
format 返回变体型
format$ 强制返回为文本
Format(Date,"YYYY 年 MM 月 DD 日")
'M 个位月只显示一位,
'MM 显示两位月,
'MMM 显示英文月简称,
'MMMM 显示英文全名
General Date
Format$(Now,"General Date") 返回值 2006-5-25 14:56:15
Long Date 操作系统定义的长日期
Format$(Now,"Long Date") 返回值 2006 年 5 月 25 日
Medium Date 中日期(yy/mmm/dd)
Format$(Now,"Medium Date") 返回值 06-5 月-25
Short Date 操作系统定义的短日期
Format$(Now,"Short Date") 返回值 2006-5-25Long Time 操作系统定义的长时间
Format$(Now,"Long Time") 返回值 15:06:36
Medium Time 带 AM/PM 的 12 小时制,不带秒
Format$(Now,"Medium Time") 返回值 03:08 PM
Short Time 24 时制的时间,不带秒
Format$(Now,"Short Time") 返回值 15:08
自定义格式参数
: 用来标识时间字符的间隔
Format$(Time(),"hh:nn") 返回值 15:25
/ 用来标识日期字符的间隔
Format$(now,"yyyy/mm/dd") 返回值 2006-05-25
c 格式化为国标的日期和时间
Format$(Now,"c") 返回值 2006-5-25 14:56:15
y 一年中的第几天
Format$(Now,"y") 返回
Access数据库杂记 来自淘豆网www.taodocs.com转载请标明出处.