tostring date, generate(date2) force format(%tdCCYY-NN-DD)date是已经存在的数值型的日期,如2007-01-01在stata数据中点击转化的话,要在选项上面选择这两个