vb中format函数定义与用法(Definition and usage of format function in VB)
vb中format函数定义与用法(Definition and usage of format
function in VB)
When less than 0, format according to the second part,
Format$(-123, 0, ABC) returns value ABC
Format$(123, 0, ABC) returns value 123
When you share a part, format it on the left side of the semicolon
---------------------------------
Formatting of date types
---------------------------------
Note: in the Chinese operating system, the system automatically loses the month as May instead of May
Fixed format parameter
The basic type of General Date
Format$(Now, General, Date) returns the value 2006-5-25 14:56:15
The long date of the Long Date operating system definition
Format$(Now, Long, Date) return value, May 25, 2006
Date in Medium Date (yy/mmm/dd)
Format$(Now, Medium, Date) returns the value 06-5 months -25
Short date defined by Short Date operating system
Format$(Now, Short, Date) return value 2006-5-25
Long Time operating system defined for a long time
Format$(Now, Long, Time) return value 15:06:36
Medium Time with AM/PM 12 hour system, with no seconds
Format$(Now, Medium, Time) returns the value 03:08 PM
Short Time 24 time, without seconds
Format$("Now", "Short Time") returns 15:08
Custom format parameters
: interval used to identify time characters
Format$(Time (), hh:nn) returns the value of 15:25
The interval used to identify date characters
Format$(now, yyyy/mm/dd) returns value 2006-05-25
C formatted as GB date and time
Format$(Now, 'C') returns the value 2006-5-25 14:56:15
Y the first few days of the year
Format$(Now, y) returns 145
D the first few days of the month (1-366)
Format$(Now, d) returns 25
DD when the number is less than 10, the number of days in front
of 0 (01-31)
Format$("2006-1-7", "DD") returns 07
DDD weeks
The return value of Format$(Now, DDD) is Thursday
Dddd what day is it?
The return value of Format$(Now, dddd) is Thursday
Ddddd displays the standard date
Format$(Now, ddddd) returns value 2006-05-25
Dddddd long date
Format$(Now, "dddddd") return value, May 25, 2006
W what day is it in a week?
Format$(Now, w) returns 5
WW what's the first week of the year?
Format$(Now, WW) returns 21
M months (Note: when used for time, it can also be minutes)
Format$(Now, m) returns 5
Format$("Now", "h:m") returns 16:11
Mm when the number is less than 10, the number of months in front
of 0 (Note: when used for time, can also be shown as 0 minutes with)
Format$(Now, m) returns 05
Format$("Now", "hh:mm") returns 16:09
Mmm months
Format$(Now, "MMM") return value, May
Q Season 1 of the year (1-4)
Format$(Now, q) returns 2
YY two digit year (00-99)
Format$(Now, YY) returns 06
Yyyy four digit year (0100-9999)
Format$(Now, yyyy) returns 2006
H N hours per day (0-23)
Format$(Now, H) returns 16
HH when less than 10, the number of hours with 0 (00-23)
Format$("7:30:28", "HH") returns 07
N the number of minutes per hour (0-59)
Format$("7:30:28", "n") returns 30
NN when 10 is less than 0 minutes (00-59)
Format$("7:3:28", "n") returns 03
S the number of seconds in a minute (0-59)
Format$("7:30:8", "s") returns 8
SS when 10 is less than 0 minutes (00-59)
Format$("7:3:8", "SS") returns 08
Ttttt standard time, hours, when less than 10, without 0, the same as h:mm:ss
Format$("7:3:28", "ttttt") return value 7:03:28
AM/PM displays the current AM or PM
Format$(Now, AM/PM) returns value PM
A/P displays the current A or P
Format$(Now, A/P) returns value P
AMPM judges the value of 0 to 2359, AM or PM, which can be considered as equal to the number from 00:00 to 23:59, such as 1000, which can be considered as 10:00.
Format$(1000, AMPM) returns value AM
Joint formatting
M/d/yy Format$(Now, m/d/yy) returns value 5-25-06
D-mmm-yy Format$(Now, "d-mmm-yy") returns the value of 25-5 -06
D-mmmm Format$(Now, "d-mmmm") returns value 25- May
Mmmm-yy Format$(Now, "mmmm-yy") return value, May -06
The hh:mm AM/PM Format$(Now, hh:mm, AM/PM) returns the value 04:50 PM
The h:mm:ss a/p Format$(Now, h:mm:ss, a/p) returns the value 4:51:38 p
H:mm Format$(Now, "h:mm") returns 16:51
H:mm:ss Format$(Now, h:mm:ss) returns value 16:51:38
M/d/yy h:mm Format$(Now, m/d/yy, h:mm) returns value 5-25-06 16:54
----------------------------------
Formatting of text types
----------------------------------
When the two part is, the first part is non empty formatting, and the second part is the formatted expression of the null value or null value
@ match location, insert formatted text, display blank (empty string) when placeholder location does not exist
When you have only one @ sign, add formatting text to the last face
Format$("CHIN", "@a") return value CHINa
There are multiple @ placeholders, which match from right to left, and display formatted text at the appropriate location
Format$("CHIN", "@a@@") return value CHaIN
When matching, it becomes a left to right matching
Format$("CHIN", "@a@@") return value CaHIN
When the placeholder is longer than the original string, just add spaces at the appropriate location
Format$("C", "@@a@") return value blank space aC
Character placeholders. Except when the placeholder location does not exist, the rest are the same as @
When the placeholder is longer than the original string, just add spaces at the appropriate location
Format$("C", "&&a&") return value aC
< forced lower case >. Displays all characters in small format.
Format$("I, love, you", "<") returns the value "I love you"
Mandatory upper case. Show all characters in uppercase format.
Format$("I, love, you", ">") returns the value I LOVE YOU
Forces left and right to fill character placeholders. The
default value is to fill the character placeholder with right
and left.
Format$("CHIN", "@a@@") return value CaHIN
----------------------------------------
Mandatory date and time in Chinese format
----------------------------------------
AAAA week
The return value of Format$(Now, AAAA) is Friday
O Chinese month
Format$(Now, "O") return value, May
O single byte month
Format$(Now, "O") return value, May
A Chinese date
Format$(Now, A) returns twenty-six days
A single byte date
Format$(Now, a) returns 26 days
E short Chinese year
Format$("Now", "E") returns six years
E byte year only
Format$("Now", "e") returns 6 years
EE Chinese year
Format$("Now", "EE") returns value two, six years
EE single byte year
Format$(Now, "EE") return value, 2006
It's easy to think the problem of Chinese dates is so easy to solve:
Format$("Now", "EEOA") returns value two, six, May 26th
本文档为【vb中format函数定义与用法(Definition and usage of format function in VB)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。