Here are some changes that I think will get you to your goal leveraging the work you have done so far pretty easily:
1. Get the date once and store it in a variable instead of calling Get-Date 3 times.
2. After your second call to Get-WrittenTime, check if $date.Minute is less than 10. If so, prepend $min with “Zero ” (e.g. $min = “Zero $min”)
Then, if you want one function, rename your current Get-WrittenTime as Get-WrittenTimeInternal, and wrap the entire thing in a new Get-WrittenTime function (you can define functions inside of functions), and pass the date you get once into that function.
It isn’t the most elegant solution, but without redoing what you have done already it should get you to your end goal pretty quickly.