当前位置:网站首页>formatdatetime function mysql (date sub function)
formatdatetime function mysql (date sub function)
2022-08-01 12:35:00 【Full stack programmer webmaster】
Hello everyone, meet again, I'm your friend Quanstack Jun.
The formatdateTime() function returns an expression that has been formatted as a date or time expression formatdateTime(Date, [, Namedformat]) Allowed data types: Namedformat A numeric value indicating the date/time format used, ifIf omitted, vbGeneralDate is used.
The setting values of the NamedFormat parameter are as follows: Constant Value Description vbGeneralDate 0 Displays the date and/or time.If there is a date part, it is displayed in short date format.If there is a time part, it is displayed in long time format.If both are present, both parts are displayed.vbLongDate 1 Displays the date in the long date format specified in the computer's locale value.vbShortDate 2 Displays the date in the short date format specified in the computer's locale value.vbLongTime 3 Displays the time in the time format specified in the computer's locale value.vbShortTime 4 Displays the time in 24-hour format (hh:mm).
TheFormat parameter is a format string.DateTime is a time type.The return value is a formatted string, focusing on the command characters in the Format parameter:
c Display time in short time format, that is, all numbers are represented FormatdateTime('c',now); The output is: 2004-8-7 9:55:40
d corresponds to the date in the time, if the date is one digit, it will display one digit, and if it is two digits, it will display two digits.FormatdateTime('dd',now) is always displayed in two digits; the output may be 01~31 ddd displays the day of the week FormatdateTime('ddd',now); The output is: Saturday dddd and ddd display the same.But the above two may be different if they are in other countries.ddddd Displays the year, month and day in a short time format FormatdateTime('ddddd',now); The output is: 2004-8-7 dddddd Displays the year, month and day in a long time format FormatdateTime('dddddd',now); The output is: August 2004July 7
e/ee/eee/eeee Displays the year in the corresponding digits FormatdateTime('ee',now); The output is: 04 (representing the year 04)
m/mm/mmm/mmmm means month FormatdateTime('m',now); output is: 8 FormatdateTime('mm',now); output is 08 FormatdateTime('mmm',now); output is AugustFormatdateTime('mmmm',now); output for August same as ddd/dddd, may be different in other countries
yy/yyyy means year FormatdateTime('yy',now); output is 04 FormatdateTime('yyyy',now); output is 2004
h/hh,n/nn,s/ss,z/zzz represent hours, minutes, seconds, milliseconds respectively t display time in short time format FormatdateTime('t',now); The output is 10:17 tt withLong format display time FormatdateTime('tt',now); The output is 10:18:46
ampm display am or pm in long format FormatdateTime('ttampm',now); output: 10:22:57 am
If you want to add a normal string to Format, you can use double quotes to separate those special characters, so that if the normal string contains special characters, it will not be displayed as a time format: FormatdateTime('"today is” c',now); the output is: today is 2004-8-7 10:26:58
You can also add "-" or "/" to the time to separate the date: FormatdateTime('"today is" yy-mm-dd',now); FormatdateTime('"today is" yy/mm/dd',now); the output is: today is 04-08-07
You can also use ":" to separate the time FormatdateTime('"today is" hh:nn:ss',now); The output is: today is 10:32:23
Publisher: Full-stack programmer, please indicate the source: https://javaforall.cn/126689.htmlOriginal link: https://javaforall.cn
边栏推荐
- 万字解析:vector类
- bpmn-process-designer基础上进行自定义样式(工具、元素、菜单)
- Pytest e-commerce project combat (below)
- 【云享新鲜】社区周刊·Vol.73- DTSE Tech Talk:1小时深度解读SaaS应用系统设计
- R语言ggplot2可视化:使用ggpubr包的ggscatter函数可视化散点图、使用xscale函数指定X轴坐标轴度量调整方式、设置x轴坐标为scientific使用科学计数法显示坐标值
- 找出相同属性值的对象 累加数量 汇总
- win10系统重装,无法登录进行同步的情况下chrome数据恢复
- 将同级数据处理成树形数据
- 基于ArkUI eTS开发的坚果食谱(NutRecipes)
- 安装apex报错
猜你喜欢

2022 Go生态圈 rpc 框架 Benchmark

.NET analyzes the LINQ framework in depth (three: the elegant prelude of LINQ)

收藏|机械工程师面试常问问题

将同级数据处理成树形数据

CAN通信标准帧和扩展帧介绍

Pytest e-commerce project combat (below)

《MySQL核心知识》第6章:查询语句

数字化转型实践:世界级2B数字化营销的方法框架

基于ArkUI eTS开发的坚果食谱(NutRecipes)

Dameng replaces the officially authorized dm.key
随机推荐
Alibaba Cloud Official Redis Development Specification
[Nodejs] node的fs模块
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
R language ggplot2 visualization: use ggpubr package ggscatter function visualization scatterplot, use xscale wasn't entirely specified X axis measurement adjustment function, set the X coordinate for
SQL函数 SQRT
[CLion] CLion always prompts "This file does not belong to any project target xxx" solution
Meshlab & Open3D SOR filtering
Promise learning (4) The ultimate solution for asynchronous programming async + await: write asynchronous code in a synchronous way
Do wildcard SSL certificates not support multiple domains?
字体反爬之好租
OpenHarmony高校技术俱乐部计划发布
R语言检验时间序列的平稳性:使用tseries包的adf.test函数实现增强的Dickey-Fuller(ADF)检验、检验时序数据是否具有均值回归特性(平稳性)、具有均值回归特性的案例
Envoy 源码流程图
《MySQL核心知识》第6章:查询语句
如何利用DevExpress控件绘制流程图?看完这篇文章就懂了!
R语言ggplot2可视化:使用ggpubr包的geom_exec函数执行geom_*函数(没有任何参数需要放置在aes中)
[Unity3D Plugin] AVPro Video Plugin Share "Video Player Plugin"
关于亚马逊测评,你了解多少?
win10系统重装,无法登录进行同步的情况下chrome数据恢复
新书上市 |《谁在掷骰子?》在“不确定性时代”中确定前行