I want to obtain an string 'YYYYMM' from Now procedure and from the month before the current one in Delphi 4.
For example: 202106 (Now) and 202105 (Now - 1)
How can afford that?
I want to obtain an string 'YYYYMM' from Now procedure and from the month before the current one in Delphi 4.
For example: 202106 (Now) and 202105 (Now - 1)
How can afford that?
You can use
DecodeDateto split a TDateTime - like Now - into year, month and day parts. Then you can useFormatto create the string with a 4 digits year and month as 2 digits with leading zeros: