Asp.net (C #)-Data Binding and formatting (convert)
Example: <% # eval ("addtime", "{0: yyyy-mm-dd}") %>
Dataformatstring = "{0: Format String }"
1. Time Format: {0: yyyy-mm-dd}
2. Format numeric string input result
"{0: c}" 12345.6789 $12,345.68
"{0: c}"-12345.6789 ($12,345.68)
"{0: d}" 12345 12345
"{0: D8}" 12345 00012345
"{0: e}" 12345.6789 1234568e + 004
"{0: E10 }" 12345.6789 1.2345678900e + 004
"{0: F }" 12345.6789 12345.68
"{0: F0 }" 12345.6789 12346
"{0: g}" 12345.6789 12345.6789
"{0: G7}" 123456789 1.234568e8
"{0: n}" 12345.6789 12,345.68
"{0: N4}" 123456789 123,456,789.0000
"Total: {0: c}" 12345.6789 total: $12345.68
Dataformatstring = "{0: p}" // The percentage is automatically converted.
C
The value is displayed in currency format.
D
The value is displayed in decimal format.
E
The value is displayed in the scientific notation (INDEX) format.
F
The value is displayed in a fixed format.
G
The value is displayed in the regular format.
N
The value is displayed in numeric format.
X
The value is displayed in hexadecimal format.
Numeric string
Http://msdn2.microsoft.com/zh-cn/library/427bttx3 (vs.80). aspx
Date and Time Format String
Http://msdn2.microsoft.com/zh-cn/library/97x6twsz (vs.80). aspx
Enumerative Format String
Http://msdn2.microsoft.com/zh-cn/library/c3s1ez6e (vs.80). aspx
Custom Format String
Http://msdn2.microsoft.com/zh-cn/library/0asazeez (vs.80). aspx
Composite formatting
Http://msdn2.microsoft.com/zh-cn/library/txafckwd (vs.80). aspx
From: Baidu space, blue country http://hi.baidu.com/menghuan1985/item/c200ab549d3e719508be1746