- 分享
- 0
- 人气
- 7
- 主题
- 13
- 帖子
- 1837
- UID
- 76124
- 积分
- 2113
- 阅读权限
- 20
- 注册时间
- 2007-5-6
- 最后登录
- 2018-4-22
- 在线时间
- 1487 小时
|
data type 是很基础又很重要的
如果你不明白 很难会写个有效率 的系统
好像 boolean
你的 东西 如果只有
对错 是或不是 可以 不可以
那你用 boolean 咯
好像 integer
他的 是 由
-2,147,483,648
到
2,147,483,647
你要用的如果不到 20亿 那你大可用它咯
但如果你用到 20亿 以上
你就得用 long
他是由
-9,223,372,036,854,775,808
到
9,223,372,036,854,775,807.
我肯定你够用啦
否则
overflow exception
你要算什么 那么大哦
bill gate 都没那个数字的身家
如果你一直 用 long 你就浪费很多的 ram 啦
你的program 越用越慢 因为一直要调用资源 和 回流资源
释放 和 回流都很慢 大嘛
如果你的server 或pc 有 128GB Ram 我没话好说
不用动用那么多的page file 或 swap patition
好啦 那么多的废话
回主题
DateTime
这个的 DataType 很复杂
=========================================
vb.net
=========================================
dim ATime as DateTime = new DateTime(2008,01,01,00,00,00)
dim BTime as DateTime = DateTime.Now()
dim CTime as String = DateTime.Now.Year()
dim DTime as DateTime = DateTime.Now.AddDays(100)
=========================================
c#
=========================================
DateTime ATime = new DateTime(2008,01,01,00,00,00);
DateTime BTime = DateTime.Now();
String CTime = DateTime.Now.Year();
DateTime DTime = DateTime.Now.AddDays(100);
=========================================
以上的答案
=========================================
ATime = 01/01/2008 12:00:00 am
BTime = 现在的时间
CTime = 2008
DTime = 现在的日期 再加 100 天
有用的 属性
=========================================
C#
=========================================
DateTime NowTime;
=========================================
VB.net
=========================================
Dim NowTime as DateTime
NowTime.Now = 现在的时间 --〉 01/01/2008 3:15:00pm
NowTime.Today = 现在的日期 --> 01/01/2008 12:00:00 am
NowTime.Year = 2008
NowTime.Date =
NowTime.Day = 13
NowTime.Hour =12
NowTime.Minute =30
NowTime.Second =30
NowTime.Millisecond =
Table 1.1 - Standard Format Characters Format Character | Format Pattern | d | MM/dd/yyyy | D | dddd, MMMM dd, yyyy | f | dddd, MMMM dd, yyyy HH:mm | F | dddd, MMMM dd, yyyy HH:mm:ss | g | MM/dd/yyyy HH:mm | G | MM/dd/yyyy HH:mm:ss | m, M | MMMM dd | r, R | ddd, dd MMM yyyy HH':'mm':'ss 'GMT' | s | yyyy-MM-dd HH:mm:ss | t | HH:mm | T | HH:mm:ss | u | yyyy-MM-dd HH:mm:ss | U | dddd, MMMM dd, yyyy HH:mm:ss | y, Y | MMMM, yyyy | Table 1.2 - List of patterns you can use to create custom formatting Format Pattern | Description | d | The day of the month. Single-digit days will not have a leading zero. | dd | The day of the month. Single-digit days will have a leading zero. | ddd | The abbreviated name of the day of the week | dddd | The full name of the day of the week | M | The numeric month. Single-digit months will not have a leading zero. | MM | The numeric month. Single-digit months will have a leading zero. | MMM | The abbreviated name of the month | MMMM | The full name of the month | y | The year without the century. If the year without the century is less than 10, the year is displayed with no leading zero. | yy | The year without the century. If the year without the century is less than 10, the year is displayed with a leading zero. | yyyy | The year including the century in four digits. | gg | The period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string. | h | The hour in a 12-hour clock. Single-digit hours will not have a leading zero. | hh, hh* | The hour in a 12-hour clock. Single-digit hours will have a leading zero. | H | The hour in a 24-hour clock. Single-digit hours will not have a leading zero. | HH, HH* | The hour in a 24-hour clock. Single-digit hours will have a leading zero.a | m | The minute. Single-digit minutes will not have a leading zero. | mm, mm* | The minute. Single-digit minutes will have a leading zero. | s | The second. Single-digit seconds will not have a leading zero. | ss, ss* | The second. Single-digit seconds will have a leading zero. | t | The first character in the AM/PM designator | tt, tt* | The AM/PM designator | z | The timezone offset (hour only). Single-digit hours will not have a leading zero. | zz | The timezone offset (hour only). Single-digit hours will have a leading zero. | zzz, zzz* | The full timezone offset (hour and minutes). Single-digit hours and minutes will have leading zeros. | : | The default time separator | / | The default date separator | % c | Where c is a standard format character. Displays the standard format pattern associated with the format character. | \ c | Where c is any character. Displays the character literally. |
http://www.dotnetjunkies.ddj.com/Tutorial/9D1C5FBF-FE27-42EA-B8C3-058FF295D822.dcik
http://blog.darkthread.net/blogs/darkthreadtw/archive/2007/04/30/tips-net-datetime-formating.aspx
[ 本帖最后由 goodday 于 2008-12-7 11:33 AM 编辑 ] |
|