如何获得当前的年,月,日(分别获得)并将所获的年数保留后两位,即2003保留为03

解决方案 »

  1.   

    decodedate(date,year,month,day);
    yearstr:=strtoint(copy(inttostr(year),2,3));
      

  2.   

    yearof(now)
    monthof(now)
    dayof(now)
      

  3.   

    decodedate(date,year,month,day);
    yearstr:=strtoint(copy(inttostr(year),2,3));
      

  4.   

    yearof(now)
    monthof(now)
    dayof(now)
      

  5.   

    我记得是有那个函数的.不过我忘了.
    一个笨办法.
    strDate:=formatdatetime('yymmdd',now);
    然后用字符串堆取函数
    copy(strDate,1,2)  年
    copy(strDate,3,2)  月
    copy(strDate,5,2)  日
      

  6.   

    yearof(now)
    monthof(now)
    dayof(now)
      

  7.   

    uses DateUtils
    年自己在取一次
    copy(inttostr(yearof(now)),3,2);