• 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: Sun, 05 Mar 2017 23:05:29 +0000
  • Thread-topic: Conversion of ISO Date String to AppleScript Date

Shane,

Many thanks for you review and critique of my date handler.
Please see my responses below.

Best Regards,

 

Jim Underwood

aka JMichaelTX


From: Shane Stanley <email@hidden>
Date: Sun, Mar 5, 2017 at 5:55 AM
To: "ASUL (AppleScript)" <email@hidden>
Subject: Re: Conversion of ISO Date String to AppleScript Date

On 5 Mar 2017, at 5:57 pm, Jim Underwood <email@hidden> wrote:
please try to shoot holes in this script.

To be picky, you talk about "ISO dates", by which you presumably mean ISO 8601 dates. And you only handle a small subset

Yes, I meant ISO 8601, but only in a very limited manner.  As I stated in my script comments, I am NOT attempting to handle time zone offsets.  My script is intended to work only with local time zone.


    • pDateStr    | text | Date String in ISO format 

                                 Assumes local time zone

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




(and I think you're actually venturing outside ISO 8601 with the space instead of a T -- that's more RFC 3339), which is fine. But you're not trapping for the other possibilities.

Actually, my script works equally well with either a "T" or a SPACE between the date and time.
It looks for the data by position, not by delimiter.
As I stated in my script comments:


    like any of these:

      2016-01-05

      2016-01-05 13:01:15

      2016-01-05T13:01:15





So if you get a string like "2016-01-05T13:01:15Z", rather than erroring, you're going to return a potentially erroneous date. Perhaps you should also test for a maximum length, at least.

That is an excellent point.  Thank you.
I will add additional data validation to check for any characters that indicate time zone.


--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

 _______________________________________________
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: Jim Underwood <email@hidden>
References: 
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Ed Stockly <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Shane Stanley <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Jim Underwood <email@hidden>)
 >Re: Conversion of ISO Date String to AppleScript Date (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Conversion of ISO Date String to AppleScript Date
  • 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