当前位置:网站首页>formatdatetime函数 mysql(date sub函数)
formatdatetime函数 mysql(date sub函数)
2022-08-01 12:02:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
formatdateTime()函数返回表达式,此表达式已被格式化为日期或时间 表达式 formatdateTime(Date, [, Namedformat]) 允许数据类型: Namedformat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.
NamedFormat参数的设置值如下: 常数 值 描述 vbGeneralDate 0 显示日期和/或时间。如果有日期部分,则用短日期格式显示。如果有时间部分,则用长时间格式显示。如果都有,两部分都显示。 vbLongDate 1 用计算机区域设置值中指定的长日期格式显示日期。 vbShortDate 2 用计算机区域设置值中指定的短日期格式显示日期。 vbLongTime 3 用计算机区域设置值中指定的时间格式显示时间。 vbShortTime 4 用24小时格式(hh:mm)显示时间。
Format参数是一个格式化字符串。DateTime是时间类型。返回值是一种格式化后的字符串,重点来看Format参数中的指令字符:
c 以短时间格式显示时间,即全部是数字的表示 FormatdateTime(‘c’,now); 输出为:2004-8-7 9:55:40
d 对应于时间中的日期,日期是一位则显示一位,两位则显示两位 FormatdateTime(‘d’,now); 输出可能为1~31 dd 和d的意义一样,但它始终是以两位来显示的 FormatdateTime(‘dd’,now); 输出可能为01~31 ddd 显示的是星期几 FormatdateTime(‘ddd’,now); 输出为: 星期六 dddd 和ddd显示的是一样的。 但上面两个如果在其他国家可能不一样。 ddddd 以短时间格式显示年月日 FormatdateTime(‘ddddd’,now); 输出为:2004-8-7 dddddd 以长时间格式显示年月日 FormatdateTime(‘dddddd’,now); 输出为:2004年8月7日
e/ee/eee/eeee 以相应的位数显示年 FormatdateTime(‘ee’,now); 输出为:04 (表示04年)
m/mm/mmm/mmmm 表示月 FormatdateTime(‘m’,now); 输出为:8 FormatdateTime(‘mm’,now); 输出为 08 FormatdateTime(‘mmm’,now); 输出为 八月 FormatdateTime(‘mmmm’,now); 输出为 八月 和ddd/dddd 一样,在其他国家可能不同
yy/yyyy 表示年 FormatdateTime(‘yy’,now); 输出为 04 FormatdateTime(‘yyyy’,now); 输出为 2004
h/hh,n/nn,s/ss,z/zzz 分别表示小时,分,秒,毫秒 t 以短时间格式显示时间 FormatdateTime(‘t’,now); 输出为 10:17 tt 以长时间格式显示时间 FormatdateTime(‘tt’,now); 输出为10:18:46
ampm 以长时间格式显示上午还是下午 FormatdateTime(‘ttampm’,now); 输出为:10:22:57上午
如果要在Format中加普通的字符串,可以用双引号隔开那些特定义的字符,这样普通字符串中如果含特殊的字符就不会被显示为时间格式啦: FormatdateTime(‘”today is” c’,now); 输出为:today is 2004-8-7 10:26:58
时间中也可以加”-“或”/”来分开日期: FormatdateTime(‘”today is” yy-mm-dd’,now); FormatdateTime(‘”today is” yy/mm/dd’,now); 输出为: today is 04-08-07
也可以用”:”来分开时间 FormatdateTime(‘”today is” hh:nn:ss’,now); 输出为:today is 10:32:23
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/126689.html原文链接:https://javaforall.cn
边栏推荐
- 华硕和微星多款产品将升级英特尔Arc A380和A310显卡
- Pytest e-commerce project combat (below)
- [5 days countdown] to explore the secret behind the great quality promotion, gift waiting for you to take of $one thousand
- 2022 Go ecosystem rpc framework Benchmark
- [Open class preview]: Research and application of super-resolution technology in the field of video quality enhancement
- 【随心笔记】假期快过去了,都干了点什么
- [Nodejs] fs module of node
- 重磅消息 | Authing 实现与西门子低代码平台的集成
- CAN通信的数据帧和远程帧
- 如何设计一个分布式 ID 发号器?
猜你喜欢

如何利用DevExpress控件绘制流程图?看完这篇文章就懂了!

音视频技术开发周刊 | 256

STM32 CAN过滤器配置详解
![[Open class preview]: Research and application of super-resolution technology in the field of video quality enhancement](/img/fc/cd859efa69fa7b45f173de74c04858.png)
[Open class preview]: Research and application of super-resolution technology in the field of video quality enhancement

Data frame and remote frame of CAN communication

字体反爬之好租

新书上市 |《谁在掷骰子?》在“不确定性时代”中确定前行

轮询和长轮询的区别

ECCV22|只能11%的参数就能优于Swin,微软提出快速预训练蒸馏方法TinyViT

基于ArkUI eTS开发的坚果食谱(NutRecipes)
随机推荐
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
深入理解 Istio —— 云原生服务网格进阶实战
JS 中的 undefined 和 null 的区别
表达式引擎在转转平台的实践
C#/VB.NET 将PPT或PPTX转换为图像
基于ArkUI eTS开发的坚果食谱(NutRecipes)
【随心笔记】假期快过去了,都干了点什么
.NET性能优化-使用SourceGenerator-Logger记录日志
[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement
Js手写函数之new的模拟实现
【云享新鲜】社区周刊·Vol.73- DTSE Tech Talk:1小时深度解读SaaS应用系统设计
Excel表格打印时不打印标记填充颜色
R语言两个时间序列数据的滞后相关性可视化:使用forecast包的ccf函数绘制交叉相关函数,根据可视化结果分析滞后相关性
MVVM响应式
爱可可AI前沿推介(8.1)
Complete Raiders of JS Data Type Conversion
【CLion】CLion 总是提示 “This file does not belong to any project target xxx” 的解决方法
CAN通信的数据帧和远程帧
markdown常用数学符号cov(markdown求和符号)
activiti工作流的分页查询避坑