In role Dateish§

See primary documentation in context for method yyyy-mm-dd

method yyyy-mm-dd(str $sep = "-" --> Str:D)

Returns the date in YYYY-MM-DD format (ISO 8601). The optional positional argument $sep, which defaults to -, is a one-character separator placed between the different parts of the date.

say Date.new("2015-11-15").yyyy-mm-dd;   # OUTPUT: «2015-11-15␤»
say DateTime.new(1470853583).yyyy-mm-dd; # OUTPUT: «2016-08-10␤»
say Date.today.yyyy-mm-dd("/");          # OUTPUT: «2020/03/14␤»