• 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: Conversion of ISO Date String to AppleScript Date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conversion of ISO Date String to AppleScript Date


  • Subject: Re: Conversion of ISO Date String to AppleScript Date
  • From: Jim Underwood <email@hidden>
  • Date: Mon, 06 Mar 2017 01:19:22 +0000
  • Thread-topic: Conversion of ISO Date String to AppleScript Date

Shane,

Thanks for your review of has' Date.scptd script library.
I was just going to ask if anyone had used it, or had comments on it.  ðŸ˜„

I'm not sure if I'm the OP here or not, but my (roughly) ISO date string processing is to handle these cases, ALL of which assume a local time zone.  Note that the date and time may have ANY 1-char delimiter, such as SPACE or "T".


    â€¢ pDateStr    | text | Date String in ISO format 

                             Assumes local time zone

                             If time is included, assumed to be 24-HR format

  

  pDateStr MUST be in the format of 

    YYYY<delim>MM<delim>DD

      OR, if time with minutes is included:

    YYYY<delim>MM<delim>DD<AnyChar>HH<delim>MM

      OR, if time with seconds is included:

    YYYY<delim>MM<delim>DD<AnyChar>HH<delim>MM<delim>SS

    in local time.

    where <delim> can be any character

    like any of these:

      2016-01-05

      2016-01-05 13:01:15

      2016-01-05T13:01:15

      2016-01-05 13:01

      2016-01-05 13:01:15




I still need to add validation to trap for any time zone info at the end of the string.  I will probably just throw an error to keep things simple.  Thanks to Shane for pointing out the need for this.

Best Regards,

Jim Underwood
aka JMichaelTX


From: <applescript-users-bounces+jmichael=email@hidden> on behalf of Shane Stanley <email@hidden>
Date: Sun, Mar 5, 2017 at 5:42 PM
To: "ASUL (AppleScript)" <email@hidden>
Subject: Re: Conversion of ISO Date String to AppleScript Date

On 6 Mar 2017, at 9:52 am, has <email@hidden> wrote:
Not that Apple's code doesn't include its own embarrassing share of bugs, flaws, and limitations

It does...

but given the choice between relying on their ISO8601 parsing code and your (or my) ISO8601 parsing code, it's not even a contest.

Except that what the OP wants parsed is not "canonical" ISO 8601 as defined in your library -- his sample string, and the ones in the comments to his script, don't match the strict rule you use.
 _______________________________________________
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: Conversion of ISO Date String to AppleScript Date
      • From: Shane Stanley <email@hidden>
References: 
 >Re: Conversion of ISO Date String to AppleScript Date (From: has <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: "Stockly, Ed" <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: has <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Scripting Better Applescript support requests !
  • Next by Date: Re: Conversion of ISO Date String to AppleScript Date
  • Previous by thread: Re: Conversion of ISO Date String to AppleScript Date
  • Next by thread: Re: Conversion of ISO Date String to AppleScript Date
  • Index(es):
    • Date
    • Thread