select month(current_timestamp()); 
得出来是7,怎么能生成07????

解决方案 »

  1.   

    mysql> select right(concat('0',month(current_timestamp())),2);
    +-------------------------------------------------+
    | right(concat('0',month(current_timestamp())),2) |
    +-------------------------------------------------+
    | 07                                              |
    +-------------------------------------------------+
    1 row in set (0.00 sec)
      

  2.   

    本帖最后由 ACMAIN_CHM 于 2012-07-02 08:52:30 编辑
      

  3.   

    select date_format(current_timestamp(),'%m')
      

  4.   

    select date_format(current_timestamp(),'%m')