• 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: Can't Coerce String to Date?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't Coerce String to Date?


  • Subject: Re: Can't Coerce String to Date?
  • From: Thomas Fischer <email@hidden>
  • Date: Sat, 14 Mar 2015 12:12:43 +0100

Hello Yvan,

> log "Now surprising behavior. If somebody may explain it, I'm interested."
> try
> 	set aString to "12 31/1943"
> 	date aString
> 	log "???? " & result (*???? vendredi 13 mars 2015 12:31:00*)
> on error
> 	log "The string doesn't match the current format : " & date string of (current date)
> end try
> try
> 	set aString to "12 31 1943"
> 	date aString
> 	log "???? " & result (*???? vendredi 13 mars 2015 12:31:00*)
> on error
> 	log "The string doesn't match the current format : " & date string of (current date)
> end try
>
> On the system used in French, lhe events log is :
>
> (*date vendredi 31 décembre 1943 00:00:00*)
> (*date jeudi 31 décembre 2043 00:00:00*)
> tell current application
> 	current date
> 	(*The string doesn't match the current format : vendredi 13 mars 2015*)
> 	current date
> 	(*The string doesn't match the current format : vendredi 13 mars 2015*)
> 	(*Now surprising behavior. If somebody may explain it, I'm interested.*)
> 	(*???? vendredi 13 mars 2015 12:31:00*)
> 	(*???? vendredi 13 mars 2015 12:31:00*)
> end tell
>
> It will be different on system running in English.

this actually seems to be a compilation issue.
If aString is not a date, then the current date is taken (bug or feature?).

And this only works with variables, if you try to do this directly,
	date "12 31 1943"
and
	date "12 31/1943"
or
	date "24 34 561943"
is changed immediately into
	date "Samstag, 14. März 2015 12:31:00"
(the current date) if you translate the script.
Other entries, e.g.
	date "25 34 561943" (!)
give an error message on my machine if I try to compile.

Best
Thomas



Mit freundlichen Grüßen
Thomas Fischer

---
Dr. Thomas Fischer
Permosergasse 23a
5026 Salzburg
Tel.: (+43) (0)662 621498
E-Mail: email@hidden




 _______________________________________________
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


  • Follow-Ups:
    • Re: Can't Coerce String to Date?
      • From: Yvan KOENIG <email@hidden>
References: 
 >Can't Coerce String to Date? (From: Alex Hall <email@hidden>)
 >Re: Can't Coerce String to Date? (From: Yvan KOENIG <email@hidden>)
 >Re: Can't Coerce String to Date? (From: Alex Hall <email@hidden>)
 >Re: Can't Coerce String to Date? (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: Can't Coerce String to Date?
  • Next by Date: Re: Can't Coerce String to Date?
  • Previous by thread: Re: Can't Coerce String to Date?
  • Next by thread: Re: Can't Coerce String to Date?
  • Index(es):
    • Date
    • Thread