Date formatting change within dates inside a text file

I have a shortcut that creates the text and then writes this to a text file on iCloud. I have
included as an example hard coded in this shortcut

https://www.icloud.com/shortcuts/710061123a484f3e9ae56268f9de1ec6

now I want to change the format of the date displayed.
When I generate a new file each day then I can change the formatting of this no problem.

But I want to convert the current dates in the file to the new format of
EEE, dd/mm/yyyy or EG sun, 23/12/2023.

This shortcut above is only dealing with convert the format as I want but I am having difficulty replacing the date with the new formatting can anyone assist in correcting the final part?

You need a variable to repeatedly update the text, a Repeat with each loop to replace one date at a time, and an If to avoid re-replacing a date (because your new date format includes the old one):

https://www.icloud.com/shortcuts/68437a10846a464d925c4918d8064245

1 Like

Your way of doing this works perfectly and so much better

I have managed to do this my way but not in the ideal way
My shortcut asks to select the file from iCloud then using the count of the dates I just run the shortcut this number of times
Here’s my shortcut

https://www.icloud.com/shortcuts/6fb3ef32f39d4d37bf4818a6d07a0b04

I will incorporate your repeat loop as the hard coded version I posted was so you all could run this and see where I was going wrong

Many thanks

1 Like

A minimalist but less flexible alternative:

https://www.icloud.com/shortcuts/202929f433b14939b7dce9e72b595a9f

This one uses a couple of particular details:

  • The new date is just the old preceded by the weekday
  • Each date is the beginning of a block of text preceded by an empty line

It also uses magic variables and type casting to the extreme :sweat_smile:

1 Like