当前位置:网站首页>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
边栏推荐
- 如何获取微信视频号的地址(微信公众号的链接地址)
- Deep understanding of Istio - advanced practice of cloud native service mesh
- 2022 Go生态圈 rpc 框架 Benchmark
- CloudCompare & PCL ICP registration (point to face)
- [Nodejs] node的fs模块
- 大中型网站列表页翻页过多怎么优化?
- 重庆市大力实施智能建造,推动建筑业数字化转型,助力“建造强市”
- win10系统重装,无法登录进行同步的情况下chrome数据恢复
- Fault 007: The dexp derivative is inexplicably interrupted
- 通配符SSL证书不支持多域名吗?
猜你喜欢
随机推荐
字体反爬之好租
表连接详解
【倒计时5天】探索音画质量提升背后的秘密,千元大礼等你来拿
Js手写函数之new的模拟实现
mysql进阶(二十二)MySQL错误之Incorrect string value中文字符输入错误问题分析
小程序插件如何帮助开发者受益?
markdown常用数学符号cov(markdown求和符号)
【讲座分享】“营收“看金融
[Nodejs] node的fs模块
The use of Ts - Map type
Aeraki Mesh 加入 CNCF 云原生全景图
pandas connects to the oracle database and pulls the data in the table into the dataframe, filters all the data from the current time (sysdate) to one hour ago (filters the range data of one hour)
[CLion] CLion always prompts "This file does not belong to any project target xxx" solution
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
MarkDown公式指导手册
音视频技术开发周刊 | 256
程序员的自我修养
Meshlab&Open3D SOR滤波
Several methods of appending elements are commonly used in js: append, appendTo, after, before, insertAfter, insertBefore, appendChild
一文带你读懂云原生、微服务与高可用








