当前位置:网站首页>FormatDateTime的用法
FormatDateTime的用法
2022-07-23 17:57:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
FormatDateTime的用法 声明: function FormatDateTime(const Format: string; DateTime: TDateTime): string; overload; 当然和Format一样还有一种,但这里只介绍常用的第一种 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/126804.html原文链接:https://javaforall.cn
边栏推荐
- 解密:智能化变电站中PTP时钟同步(北斗时钟服务器)
- not all arguments converted during string formatting
- Industry analysis | logistics intercom
- Elk note 25 - expérience rapide APM
- Alibaba's latest masterpiece! It took 187 days for the liver to come out. 1015 pages of distributed full stack manuals are so delicious
- Ros2 self study notes: rviz visualization tool
- C language small project - address book (static version + dynamic version + file version)
- 总结一些最近见到的 TRICK
- 时代潮头,华为将风帆对准数字金融的风与海
- Detailed explanation of TCL scripting language (1)
猜你喜欢

行业分析| 物流对讲

虹科干货 | 教您如何解析MODBUS中的浮点型数据

正则化不同导致的tuple错误

FPGA flash reading and writing based on SPI

Todo fix bug tag feature and other configurations

PowerCLi 管理VMware vCenter 批量部署导出导入

【C语言】程序环境和预处理

Type-C Bluetooth speaker single C-Port rechargeable OTG solution

Little fish sends lidar | just dinner is the first lottery

Weights & biases (I)
随机推荐
树莓派ssh登录
How can win11 add 3D effects to pictures? Win11 method of adding picture 3D effect
Type-C Bluetooth speaker single C-Port rechargeable OTG solution
Testing scheme of granite dielectric constant by network
Canvas draw text and clear draw
.net core implements background tasks (scheduled tasks) longbow Tasks component (III)
PowerCLi 管理VMware vCenter 一键批量部署OVA
.Net CLR R2R编译的原理简析
R语言使用ggpubr包的ggarrange函数将多幅图像组合起来、使用ggexport函数将可视化图像保存为bmp格式(width参数指定宽度、height参数指定高度、res参数指定分辨率)
MySQL数据库【数据库基础--引入篇】
[shutter -- layout] flexible layout (flex and expanded)
总结一些最近见到的 TRICK
Read data from txt and convert it to Yolo format data
【pm2】pm2常用命令
当代励志“女”录
R语言data.table包进行数据分组聚合统计变换(Aggregating transforms)、计算dataframe数据的分组最小值(min)
Alibaba最新神作!耗时187天肝出来1015页分布式全栈手册太香了
PowerCLi 管理VMware vCenter 一键批量部署OVF
not all arguments converted during string formatting
.Net CLR R2R编译的原理简析