you can achieve that using combination of to_datetime and datetime_format. Please post the code that you are using and we can figure out why its not working.
for instance - i would use something like this
STRING x_date;
DATETIME startDate;
startDate = to_datetime(“2021-08-16 14:05:57”);
x_date = datetime_format(startDate,"%Y-%m-%d")