hi , I want to extract the month and day of the current date (c(current_date)) and display them in the format of month and day, occupying two digits respectively. When the month or day is only the ones digit, use zero to fill the digit
date wanted
29 Sep 2021 0929
09 Aug 2021 0809
01 Dec 2021 1201
The codes that I solve the problemto as follows:
scalar M = month(date(c(current_date),"DMY"))
scalar D = day(date(c(current_date),"DMY"))
scalar MD = `=M'`=D' // why it's wring
di "`=M'`=D'" // the result is 929, but i want 0929
Looking forward to your help,thank you very much
date wanted
29 Sep 2021 0929
09 Aug 2021 0809
01 Dec 2021 1201
The codes that I solve the problemto as follows:
scalar M = month(date(c(current_date),"DMY"))
scalar D = day(date(c(current_date),"DMY"))
scalar MD = `=M'`=D' // why it's wring
di "`=M'`=D'" // the result is 929, but i want 0929
Looking forward to your help,thank you very much
Comment