Format decimal bits and date

xiaoxiao2021-03-06  69

Self-roller-reserved two decimals:

Double Dvalue = 0.2356; Double Result = System.math.Round (Dvalue, 2);

or

Use i.tostring directly ("0.00")

format

date:

TOSTRING ("YYYY-MM-DD")

Return to 2004-9-7

time:

ATAFORMATSTRING = "{0: hh: mm: ss}"

(:) Time separator. In some locale, you can use other characters to represent time separators. Time separator is separated by hours, minutes, and seconds when formatting time values. The actual characters used as the time separator in the format output are determined by the LocaleID value of the system. (/) Date separator. In some locale, you can use other characters to indicate the date separator. Date separator Dialect date, month, and year while formatting date values. The actual characters used for the date separator in the format output are determined by your locale. (%) It is used to indicate what alphabets, whether the character should be read in a single letter format. It is also used to indicate that a single alphabetic format should be read in a user-defined format. For more information, see the following contents. D shows the day as a digital (such as 1). If this is a unique character in the user-defined digital format, use% D. DD will display the day as a digital (such as 01). DDD will display the day as an abbreviated form (for example, Sun). DDDD will display the day as a full name (such as Sunday). M The month is displayed as a digital number without lead-guided zero (as shown in Jan). If this is the unique character in the user-defined digital format, use% M. MM displays the month as a front guide (for example 01/12/01). MMM displays the month as an abbreviation form (for example, JAN). MMMM displays the month as a full month name (such as January). The GG display era / era string (such as A.D.) h displays the hour to display the digital (for example, 1: 15: 15 pm). If this is the unique character in the user-defined digital format, use% H. HH uses 12 hours to display the hour to the front guide (for example, 01:15:15 pm). H Display the hour to use the 24-hour system to display the digital (for example, 1:15:15). If this is the unique character in the user-defined digital format, use% H. HH uses 24-hour system to display a number with a leading zero (for example, 01:15:15). m Display the minutes as numbers without leading zero (for example, 12: 1: 15). If this is the unique character in the user-defined digital format, use% M. The mm displays a number with a leading zero (eg 12: 01:15). s The second is displayed as a number without lead-guided zero (for example, 12: 15: 5). If this is the unique character in the user-defined digital format, use% s. SS displays the seconds of the front guide (for example, 12:15:05). F shows the fractional part of the second. For example, FF will exactly display one second, and FFFF will exactly displays a thousand seconds. User-defined formats can use the seven F symbols. If this is the unique character in the user-defined digital format, use% F. T use 12 hours, and the uppercase is displayed at any hour before noon, and the upper-write P is displayed at any hour of noon to 11:59 p.m. If this is the unique character in the user-defined digital format, use% T. TT uses 12 hours of use, and the uppercase is displayed on any hour before noon; the upper-write PM is displayed at any hour between noon to 11:59 p.m. y Displayed the number (0-9) as a number without lead-guided zero. If this is a unique character in the user-defined digital format, use% Y. YY displays the year (if applicable) with a lead-zero two digital format. YYY shows the year in four digits format. YYYY shows the year in four digits format. Z Displays the time zone offset (such as -8) without a leading zero. If this is a unique character in the user-defined digital format, use% Z.

转载请注明原文地址:https://www.9cbs.com/read-119683.html

New Post(0)