• 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: Universal Date Entry (was: Date - 1 day in Address Book)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Universal Date Entry (was: Date - 1 day in Address Book)


  • Subject: Re: Universal Date Entry (was: Date - 1 day in Address Book)
  • From: Gary Lists <email@hidden>
  • Date: Wed, 23 Jul 2003 02:35:09 -0400

On or about 7/22/03 10:56 PM, kai wrote:

> I suppose one might try to adapt the handler posted by Paul B, which in turn
> was based on one of Nigel Garvey's rather neat tricks. Here's a variation
> that attempts to offer an alternative to the repeat loop:


Thank to all of you Gentlemen.


> -------------------------------------------------------
> (Any wrapped lines abutting the left edge of the window
> should be reconnected to the end of the previous line)
> -------------------------------------------------------
>
> --===========
>
> on uDate(v)
> set t to "1.2.3" -- modify to dictate input sequence
> set {day:d, year:y} to date t
> set y to y mod (y div 100 * 100)
> set text item delimiters to "." -- the separator used for input
> set u to (get v's {text item d, text item (6 - d - y), text item y})
> as string
> set text item delimiters to ""
> date u
> end uDate
>
> uDate("2.9.1970") as string
>
> --===========

"Clever girl." -- the gamekeeper in Juraissac Park, about the Raptor who
gets the better of him.

But here, alas, I refer to AppleScript.

Is this forward-looking/backward-looking "break point" wrapped around the
1990's [1] generally true in 2-digit dates in AppleScript? On the Mac?

It's quite convenient, I suppose, as it (seems to) assume a proximity
context that is probably mostly true (although I think I'll stick with
4-digit years.)

I quite like this handler, as my download folder contains daily folders
named in ISO format, created each day anew by way of a Folder Action. I
added this handler to my BBEdit folder listing script, and now I can convert
the folder ISO-date names to more human readable names when I list the
hierarchy of the downloads folder. Great application for me, right away.

Again, thanks for this, Kai, and thanks to Paul B. for his earlier handler
(which I also promptly snagged).
--
Gary


[1] My results (AS 1.8.3, OS9.1)

Two-digit years that are:

'00' to '90' --> 20__

'91' through '99' --> 19__

Here are some results:

uDate("30.07.89") as string
-- "Saturday, July 30, 2089 12:00:00 AM"
-- forward-looking

uDate("31.12.90") as string
-- "Sunday, December 31, 2090 12:00:00 AM"
-- forward-looking

uDate("31.12.91") as string
-- "Tuesday, December 31, 1991 12:00:00 AM"
-- backward-looking

uDate("30.07.98") as string
-- "Thursday, July 30, 1998 12:00:00 AM"
-- backward-looking

uDate("30.07.99") as string
-- "Friday, July 30, 1999 12:00:00 AM"
-- backward-looking

uDate("31.12.00") as string
-- "Sunday, December 31, 2000 12:00:00 AM"
-- backward-looking

uDate("31.12.03") as string
-- "Wednesday, December 31, 2003 12:00:00 AM"
-- forward-looking

uDate("09.02.04") as string
-- "Monday, February 9, 2004 12:00:00 AM"
-- forward-looking
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Universal Date Entry (was: Date - 1 day in Address Book)
      • From: Gary Lists <email@hidden>
References: 
 >Universal Date Entry (was: Date - 1 day in Address Book) (From: kai <email@hidden>)

  • Prev by Date: Re: Applescripting Preview or print to pdf for pdf creation
  • Next by Date: Re: Sandi's Additions for OS X??
  • Previous by thread: Universal Date Entry (was: Date - 1 day in Address Book)
  • Next by thread: Re: Universal Date Entry (was: Date - 1 day in Address Book)
  • Index(es):
    • Date
    • Thread