Vb. NET, the Format function

Source: Internet
Author: User
Tags current time time and date
The function Format function can decorate date, numeric, and string type data, and the data type of the returned value is a string. The following syntax is used:

Format (data to be decorated [, formatting to be decorated [, first day of the week [, first week of year]])

The parameters of the format are some meaningful symbols, and the meaning of these symbols is shown in the following table:

Symbolic meaning

0 value configuration symbol, if the specified position does not have a value prints 0

# A value configuration symbol, if 0 before this symbol is not printed

. Decimal point configuration symbol

, the thousand-symbol

-_$ () and spaces literal characters are printed out of 1510

The following program formats the value 50000 as $50,000.00:
<%
Response.Write ("Accounts Payable for" & Format (50000, "$##,###.00"))
%>

Print the specified time and date format
The Format function can also be used to decorate the time and date, assuming the current time is still 9 points 10 minutes 11 seconds on Friday, June 1, 2001, as shown in the following table:

Syntax results
Format (now (), "M/d/yy") 6/1/01
Format (now (), "MM month DD Day, dddd,yyyy Year") June 01, Friday, 2001
Format (now (), "mmm-d") June-1
Format (now (), "h:m:s") 9:10:11
Format (now (), "Hh:mm:ss") 09:10:11


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.