Dear All,
I would be really grateful for your help on this matter. I am trying to create a specific date, and followed a link which said that you should make a variable using the current date, and then change the year, month, day, etc. This seems to be fine, except that when I am changing over the month, it is changing into the wrong month. I am inputting 9 for September - I have logged this to check the details, and it is outputting October. I cannot see any reason for this, and I need to get this completed. Is there a better way, and why is this error occurring at all???
set dateWordsArray to words of theDate
set returnedDay to item 1 of dateWordsArray
set returnedMonth to item 2 of dateWordsArray
if returnedMonth is equal to "January" then
set returnedMonth to 1
else if returnedMonth is equal to "February" then
set returnedMonth to 2
else if returnedMonth is equal to "March" then
set returnedMonth to 3
else if returnedMonth is equal to "April" then
set returnedMonth to 4
else if returnedMonth is equal to "May" then
set returnedMonth to 5
else if returnedMonth is equal to "June" then
set returnedMonth to 6
else if returnedMonth is equal to "July" then
set returnedMonth to 7
else if returnedMonth is equal to "August" then
set returnedMonth to 8
else if returnedMonth is equal to "September" then
set returnedMonth to 9
else if returnedMonth is equal to "October" then
set returnedMonth to 10
else if returnedMonth is equal to "November" then
set returnedMonth to 11
else if returnedMonth is equal to "December" then
set returnedMonth to 12
end if
set returnedYear to item 3 of dateWordsArray
log returnedMonth
set year of activeDate to returnedYear
set month of activeDate to returnedMonth
log activeDate
The log that is coming back is as follows:
(*9*)
(*date Sunday, 1 October 2017 at 21:46:10*)
Any help would be much appreciated. Kindest regards,
DDHawk
Model: MacBook Pro
AppleScript: 2.9
Browser: Safari 602.3.12
Operating System: Mac OS X (10.10)