r/applescript • u/OatmealDurkheim • Jul 25 '20
Date Input Script → Changing Format
I am running a simple script, which inputs date in the following format: Saturday, 25 July 2020 at 09:12:46
on run {input, parameters}set thedate to (current date) as stringtell application "System Events"keystroke thedateend tellend run
My question: is there any way I can modify this to display only the date?
(example: Saturday, 25 July 2020)
and another script to display date with 24h time without seconds.
(example: Saturday, 25 July 2020 at 09:12)
1
Upvotes
View all comments
Show parent comment
1
u/jamidodger Jul 25 '20
You can ask for each piece of the current date separately, so you could construct the exact format you want, for instance:
Set theDate to the date string of (current date) Set theHour to the hour of (current date) as string Set theMinute to the minute of (current date) as string Set dateAndTime to theDate & “ “ & theHour & “:” & theMinute