当前位置:网站首页>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
边栏推荐
- Audio and Video Technology Development Weekly | 256
- Beyond Compare 4 试用期到期
- leetcode每日一题:字符串压缩
- Istio Meetup China: Full Stack Service Mesh - Aeraki Helps You Manage Any Layer 7 Traffic in an Istio Service Mesh
- 蔚来又一新品牌披露:产品价格低于20万
- 程序员如何优雅地解决线上问题?
- 大众碰到点评的一个字体反爬,落地技术也是绝了
- The four methods of judging JS data type
- sql中ddl和dml(数据库表与视图的区别)
- C#/VB.NET 将PPT或PPTX转换为图像
猜你喜欢
Audio and Video Technology Development Weekly | 256
音视频技术开发周刊 | 256
表达式引擎在转转平台的实践
Programmer's self-cultivation
The four methods of judging JS data type
程序员如何优雅地解决线上问题?
The CAN communication standard frame and extended frame is introduced
How to use DevExpress controls to draw flowcharts?After reading this article, you will understand!
OpenHarmony高校技术俱乐部计划发布
leetcode/submatrix element sum
随机推荐
Meshlab&Open3D SOR滤波
Data frame and remote frame of CAN communication
博弈论(Depu)与孙子兵法(42/100)
How to Integrate Your Service Registry with Istio?
如何设计一个分布式 ID 发号器?
蔚来又一新品牌披露:产品价格低于20万
MMF的初步介绍:一个规范化的视觉-语言多模态任务框架
一文带你读懂云原生、微服务与高可用
Sparse representation - study notes
浏览器存储
MVVM响应式
The four methods of judging JS data type
SQL函数 %SQLUPPER
Beyond Compare 4 试用期到期
How to get the address of WeChat video account (link address of WeChat public account)
win10系统重装,无法登录进行同步的情况下chrome数据恢复
轮询和长轮询的区别
这项工作事关中小学生生命安全!五部门作出联合部署
表连接详解
【随心笔记】假期快过去了,都干了点什么