2008-05-26

NET得到时间

(1)、DateTime.Now.Year;  
  DateTime.Now.Month;  
  DateTime.Now.Day;  
  DateTime.Now.Hour;  
  DateTime.Now.Minute;  
  DateTime.Now.Second;

(2)、

  1、DateTime       数字型      
                System.DateTime   currentTime=new   System.DateTime();      
      1.1   取当前年月日时分秒      
                currentTime=System.DateTime.Now;      
      1.2   取当前年      
                int   年=currentTime.Year;      
      1.3   取当前月      
                int   月=currentTime.Month;      
      1.4   取当前日      
                int   日=currentTime.Day;      
      1.5   取当前时      
                int   时=currentTime.Hour;      
      1.6   取当前分      
                int   分=currentTime.Minute;      
      1.7   取当前秒      
                int   秒=currentTime.Second;      
      1.8   取当前毫秒      
          int   毫秒=currentTime.Millisecond;      
          (变量可用中文)      

(3)、System.Datetime.Now.toLongTimeString()

          System.Datetime.Now.ToString("hh:mm:ss")

评论
发表评论

提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则

您还没有登录,请登录后发表评论

心似海
搜索本博客
博客分类
最近加入圈子
存档
最新评论