[SalesForce] How to remove time from date

The following code returns the time of the current date:

System.debug('Current date: ' + Date.today().toStartOfMonth());

Output:

2018-08-01 00:00:00

How to remove time from date?

Best Answer

only way I found is to keep the date format and remove the 00 from end

System.debug('Current date: ' + String.valueOf(Date.today()).removeEnd(' 00:00:00'));