本文章主若是对Oracle to_char 的用法的描述,相对而言Oracle to_char能在很短的时刻里被普遍的应用,声名它的可现实应用性仍是占优势的,以下就是文章的具体内容的介绍,但愿你会有所收成。 1.The following are number examples for the to_char function./ f- H" V4 h2 f% w3 N8 w
2.to_char(1210.73, '9999.9') would return '1210.7'
. H( v- f2 n; K4 N8 J( a 3.to_char(1210.73, '9,999.99') would return '1,210.73'
6 Y6 L! v; r, ]: t/ l3 ~0 A 4.to_char(1210.73, '$9,999.00') would return '$1,210.73'5 G! t6 p, @- a7 S$ Y
5.to_char(21, '000099') would return '000021'+ T7 G' G- k; {3 |
6.The following is a list of valid parameters when" l$ n1 w, W7 H9 m
the to_char function is used to convert a date to a string.% }1 s: }7 V2 g; c R q
These parameters can be used in many combinations./ m, c0 v2 p- z& ^9 j+ A) q
7.Parameter Explanation
+ h* j* O; E4 t7 x# F* c# f 8.YEAR Year, spelled out0 x* O' E2 Y+ Z& }$ S9 q
9.YYYY 4-digit year
S& p. w! D; ~ 10.YYY* D, y/ d4 T. b) G; R, h( t9 X2 i
11.YY, e) A* z9 m0 C
12.Y Last 3, 2, or 1 digit(s) of year.
, f; r; a/ o4 U4 n w6 A2 Z- \ 13.IYY) {# }. D Z, N( T
14.IY( R& d B, {& H
15.I Last 3, 2, or 1 digit(s) of ISO year.$ @ G9 q* B! w$ x2 ^+ Y
16.IYYY 4-digit year based on the ISO standard7 U3 t" V. p; l. k. W
17.Q Quarter of year (1, 2, 3, 4; JAN-MAR = 1).
: z8 u# k# W1 k8 j, v. E2 ~" ^& b 18.MM Month (01-12; JAN = 01).
& R7 N3 B# s# M6 a0 r6 j' i# q 19.MON Abbreviated name of month.9 i; l9 t1 ^; L! d4 A* k/ T6 P: E
20.MONTH Name of month, padded with blanks to length of 9 characters.
. I/ B: x, L3 A6 y j/ C) \, _0 b 21.RM Roman numeral month (I-XII; JAN = I).3 M' U5 z3 W. g, _& V/ L# D0 Z1 z
22.WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.# ?# k/ m F+ [0 }
23.W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.* a# \. z9 y I% H
24.IW Week of year (1-52 or 1-53) based on the ISO standard.
_) x/ X/ s* G, A 25.D Day of week (1-7)., k0 `( v: N6 y% j2 a5 L8 F
26.DAY Name of day.
4 i0 s4 o, v: z3 u( l, } 27.DD Day of month (1-31).
# t: o' g, R! g0 m+ ]6 L& I 28.DDD Day of year (1-366).
$ @: J" N# M v4 [% y9 c 29.DY Abbreviated name of day.: T; s5 H) P. Q5 Z
30.J Julian day; the number of days since January 1, 4712 BC. |