• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Time anomaly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time anomaly


  • Subject: Re: Time anomaly
  • From: "koenig.yvan" <email@hidden>
  • Date: Sat, 27 Oct 2012 17:26:18 +0200


Le 27/10/2012 à 14:02, Brian Christmas <email@hidden> a écrit :

G'day Scripters

Just mucking about, and came across this anomaly.


Anyone know why it doesn't work?

Regards

Santa

set now to the (current date)
set themonth to (month of now as number)

copy now to now1
copy now to now2
copy now to now3

set month of now1 to (themonth + 3)
set month of now2 to (themonth + 4)
set month of now3 to (themonth + 6)

now & return & now1 & return & now2 & return & now3

#--> {date "Saturday, 27 October 2012 10:49:08 PM"  
#-->  date "Sunday, 27 January 2013 10:49:08 PM" 
#-->  date "Saturday, 28 January 2012 10:49:08 PM" 
#-->  date "Thursday, 20 October 2033 10:49:08 PM"}


Look at :

set now to the (current date)
set themonth to (month of now as number)
set theyear to year of now
set theDates to {}
repeat 24 times
copy now to end of theDates
end repeat

repeat with i from 1 to 12
set newMonth to themonth + i
set month of item (1 + (i - 1) * 2) of theDates to newMonth
if newMonth > 12 then
set newMonth to newMonth - 1
set newdate to theyear + 1
set month of item (i * 2) of theDates to newMonth
set year of item (i * 2) of theDates to newdate
else
set month of item (i * 2) of theDates to newMonth
end if
end repeat

set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set the_dates to theDates as text
set AppleScript's text item delimiters to oTIDs
the_dates
(*
"mardi 27 novembre 2012 17:23:39
mardi 27 novembre 2012 17:23:39

jeudi 27 décembre 2012 17:23:39
jeudi 27 décembre 2012 17:23:39

dimanche 27 janvier 2013 17:23:39
vendredi 27 décembre 2013 17:23:39

samedi 28 janvier 2012 17:23:39
dimanche 27 janvier 2013 17:23:39

samedi 28 janvier 2012 17:23:39
lundi 28 janvier 2013 17:23:39

jeudi 20 octobre 2033 17:23:39
lundi 28 janvier 2013 17:23:39

jeudi 17 novembre 2033 17:23:39
dimanche 20 octobre 2013 17:23:39

samedi 19 novembre 2033 17:23:39
dimanche 17 novembre 2013 17:23:39

samedi 19 novembre 2033 17:23:39
mardi 19 novembre 2013 17:23:39

mercredi 9 mars 2033 17:23:39
mardi 19 novembre 2013 17:23:39

mercredi 9 mars 2033 17:23:39
samedi 9 mars 2013 17:23:39

mardi 28 février 2012 17:23:39
samedi 9 mars 2013 17:23:39"
*)

Oops, Axel was pointing the problem.

Yvan KOENIG (VALLAURIS, France) samedi 27 octobre 2012 17:26:14


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Time anomaly (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Time anomaly
  • Next by Date: Re: How can i auto install App under ML
  • Previous by thread: Re: Time anomaly
  • Next by thread: Re: Time anomaly
  • Index(es):
    • Date
    • Thread