菜鸟请教各位高手,在C#中如何实现数字或日期的格式化啊 System.Convert.ToDouble("##0.0") 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.Convert.ToDateTime("yyyy年MM月dd日") 是这样吗double do=Convert(120.1,"##0.0"); double do=Convert.ToDouble("120.1","##0.0"); http://chs.gotdotnet.com/quickstart/howto/看“基本数据类型”\格式化基类型 一节!! 难道C#中的所有都必须转成string 再能格式成各种种样的格式吗 那么用相应类型的ToString(格式)进行输出。 DateTime mydo; mydo=DateTime.Now ; textBox1.Text = mydo.ToString("yyyy年MM月dd日", null); DateTime Formatting Format Character | Format Pattern | Associated Property/Description d MM/dd/yyyy ShortDatePattern D dddd, MMMM dd, yyyy LongDatePattern f dddd, MMMM dd, yyyy HH:mm Full date and time (long date and short time) F dddd, MMMM dd, yyyy HH:mm:ss FullDateTimePattern (long date and long time) g MM/dd/yyyy HH:mm General (short date and short time) G MM/dd/yyyy HH:mm:ss General (short date and long time) m, M MMMM dd MonthDayPattern r, R ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT’ RFC1123Pattern S yyyy-MM-dd HH:mm:ss SortableDateTimePattern (conforms to ISO 8601) using local time t HH:mm ShortTimePattern T HH:mm:ss LongTimePattern u yyyy-MM-dd HH:mm:ss UniversalSortable­DateTimePattern (conforms to ISO 8601) using universal time U dddd, MMMM dd, yyyy HH:mm:ss UniversalSortable­DateTimePattern y, Y MMMM, yyyy YearMonthPattern 切换窗口如何获得焦点和触发事件如何同步? 问一个计算问题 WinForm渐变窗体问题 c#控制skype视频聊天 怎么做不规则窗口啊用C# 能在richtextbox里添加jpg或者gif图象吗?要怎么做? 使用线程循环读取ListView控件的数据写到文件为什么界面也会假死(C#) 一个邮箱的接口程序,请大家看下这个请求处理有什么问题 关于vs.net的cd-key itextsharp 5.5.6 填充文本域后,文字不显示 文本的复制和粘贴 关于定时的简单问题
double do=Convert(120.1,"##0.0");
看“基本数据类型”\格式化基类型 一节!!
mydo=DateTime.Now ;
textBox1.Text = mydo.ToString("yyyy年MM月dd日", null);
Format Character | Format Pattern | Associated Property/Description
d MM/dd/yyyy ShortDatePattern
D dddd, MMMM dd, yyyy LongDatePattern
f dddd, MMMM dd, yyyy HH:mm Full date and time (long date and short time)
F dddd, MMMM dd, yyyy HH:mm:ss FullDateTimePattern (long date and long time)
g MM/dd/yyyy HH:mm General (short date and short time)
G MM/dd/yyyy HH:mm:ss General (short date and long time)
m, M MMMM dd MonthDayPattern
r, R ddd, dd MMM yyyy HH’:’mm’:’ss ‘GMT’ RFC1123Pattern
S yyyy-MM-dd HH:mm:ss SortableDateTimePattern (conforms to ISO 8601) using local time
t HH:mm ShortTimePattern
T HH:mm:ss LongTimePattern
u yyyy-MM-dd HH:mm:ss UniversalSortable­DateTimePattern (conforms to ISO 8601) using universal time
U dddd, MMMM dd, yyyy HH:mm:ss UniversalSortable­DateTimePattern
y, Y MMMM, yyyy YearMonthPattern