想取出来当前的年,下面语句总是显示1905-6-25showmessage(datetimetostr(yearof(now)));下面的语句显示的就是当前的时间2004-10-14 15:13:13,不知道为什么
showmessage(datetimetostr(now));

解决方案 »

  1.   

    showmessage(datetimetostr(yearof(now)));NOW() : 2004-10-14
    yearof(now): 2004 (注意:整数型!) 
    DATETINETOSTR(yearof(now)) 相当于 datetimetostr(2004) 相当于datetimetostr(TDateTime(2004) )
    而整数型的2004转换为日期类型就是1899-12-31号 +2004(天) = 1905-6-25你应该使用showmessage(inttostr(yearof(now)));
      

  2.   

    showmessage(datetimetostr(yearof(now)));windindance(风舞轻扬) ( ) 说的很好