I used to have a AppleScript snippet which convert my date to this format : 08/25/2017 (MM/DD/YY)
The source date format changed and I don't managed to make it work
e.g :
set creationDate to "2013-04-03"
set [M, ordinal, Y] to the words of creationDate
set the text item delimiters to {"st", "nd", "rd", "th"}
set cardinal to (first text item of ordinal) --> "2"
set cardinal to text -1 thru -2 of ("0" & cardinal) --> "02"
set the text item delimiters to space
set date_string to {M, cardinal, Y} as text
-- date -j -f '%B %d %Y' 'June 02 2012' +'%d/%m/%Y'
set command to {¬
"date -j -f '%B %d %Y'", ¬
quoted form of the date_string, ¬
"+'%d/%m/%Y'"}
The creation date is an example but it's taken from a webpage and it's not fix.
here the result I received
{"date -j -f '%B %d %Y'", "'2013 04 03'", "+'%d/%m/%Y'"}
Best Answer
If your example is in the order year, day, month and you want MM/DD/YYYY then this code does the job
What you are attempting to do with the
date
command is unclear.