Re: Universal Date Entry (was: Date - 1 day in Address Book)
Re: Universal Date Entry (was: Date - 1 day in Address Book)
- Subject: Re: Universal Date Entry (was: Date - 1 day in Address Book)
- From: kai <email@hidden>
- Date: Wed, 23 Jul 2003 20:03:12 +0100
on Wed, 23 Jul 2003 02:35:09 -0400, Gary Lists <email@hidden> wrote:
>
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:
>
>
Thanks to all of you Gentlemen.
>
>
> --===========
>
>
>
> 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 Jurassic Park, about the Raptor who
>
gets the better of him.
But I'm a boy!
>
But here, alas, I refer to AppleScript.
Well - I suppose that's alright, then. (No doubt this will now prompt a
flurry of speculation about the possible gender of AS - as he/she/it is
wrote.)
>
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?
----- [inserted from footnotes] -----
>
[1] My results (AS 1.8.3, OS9.1)
>
>
Two-digit years that are:
>
>
'00' to '90' --> 20__
>
>
'91' through '99' --> 19__
-------------------------------------
It actually works something like this, Gary.
For most of a century (the middle 80 years), all two-digit numbers are
assumed to be in the current century. However, in the early part of a
century, high numbered years are backward-looking and, towards the end of a
century, low numbered years are forward-looking.
More specifically (using the current century to give examples):
If the current year is in the early part of the century (2000-2010)
High year values (91-99) are in the previous century (1991-1999)
Low-mid year values (00-90) are in the current century (2000-2090)
If the current year is in the middle part of the century (2011-2090):
All year values (00-99) are in the current century (2000-2099)
If the current year is in the late part of the century (2091-2099):
Mid-high year values (11-99) are in the current century (2011-2099)
Low year values (00-10) are in the next century (2100-2110)
>
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.)
That should help to reduce confusion and unintentional results. The general
advice is to do this anyway if your dates are likely to span more than a few
years. (Two digits should be safe enough on general to-do lists or project
planning and scheduling, but it's clearly prudent to adopt 4 digits for
longer-term stuff like birth dates, genealogy, archiving or mortgages.)
>
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.
Good to hear.
>
Again, thanks for this, Kai, and thanks to Paul B. for his earlier handler
>
(which I also promptly snagged).
Have you no shame, man?
---
kai
_______________________________________________
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.