Hi,
I need to reformat hundreds of date fields.
It would be great to have an AppleScript to convert the date format from DD/MM/YYYY to YYYY.MM.DD
Any suggestion would be greatly appreciated. Thanks.
Hi,
I need to reformat hundreds of date fields.
It would be great to have an AppleScript to convert the date format from DD/MM/YYYY to YYYY.MM.DD
Any suggestion would be greatly appreciated. Thanks.
That’s what text item delimiters are for:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set oldDate to "29/07/1986" -- note this assumes your date is text.
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set tParts to text items of oldDate -- the pieces separated by the delimiter "/"
set AppleScript's text item delimiters to tid -- set them back for future
tell tParts -- avoids having to repeat "of tParts" for every item
set newDate to item 3 & "." & item 2 & "." & item 1 -- reassemble.
end tell
There’s a tutorial on doing this in the Unscripted section, as I recall.
Hi. Welcome to MacScripter.
For a fuller answer, you need to say what you mean by a “date field”. Without that knowledge, one can’t confidently help you with a script to reformat hundreds of them.
This is in the same vain as something I have been trying to do.
I need a script that will set my system clock to :07 fast. I have an application that will execute the script.
My idea is to ask the network time server for the correct time and then add :07 and set the system clock. Any ideas on this?
Model: Mac Mini
Browser: Safari 601.4.4
Operating System: Mac OS X (10.10)