Subject: | |
From: | |
Reply To: | |
Date: | Fri, 28 Jun 2013 14:12:44 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Mark Lively
Senior Analyst/Programmer
AccuWeather
385 Science Park Road, State College, PA 16803
P: 814-237-0309, ext: 7686 M: 814-574-0494
E: [log in to unmask]
AccuWeather.com
On Jun 28, 2013, at 9:16 AM, Shane Stanley <[log in to unmask]> wrote:
> On 28/06/2013, at 10:04 PM, Mark Lively <[log in to unmask]> wrote:
>
>> If you are will to dive into ASOC (Applescript Objective C) aka Cocoa AppleScript the following works.
>
> Almost...
>
>> set aDate to NSDate's dateWithTimeIntervalSinceNow_((date "Friday, January 1, 1904 12:00:00 AM") - (current date))
>
> That's not reliable because of daylight savings time. You need to convert from AS dates to NSDates with something like (adjust date string to match your settings):
>
Good catch. I just looked and saw Dec 31, 1913 and thought, I’m gmt-4 that’s the thing. Looking now it’s 11pm.
> on makeNSDateFrom_(theASDate)
> set refDate to date "Friday, 1 January 1904 0:00:00" as date
> set theDiff to theASDate - refDate - 3.061152E+9 - (time to GMT) + (current application's NSTimeZone's localTimeZone()'s daylightSavingTimeOffset()) as real
> set newDate to current application's NSDate's dateWithTimeIntervalSinceReferenceDate_(theDiff)
> return newDate
> end makeNSDateFrom_
>
>> Remembers when time began in 1904, now time begins in 1970.
>
> You're behind the times. Cocoa time begins in 2001.
>
I seem to remember that. You know it’s just wrongheaded.
-Mark
If I am elected president my first action will be signing an executive order ending Daylight Savings Time.
If I am re-elected president my first action after inauguration will be to put the entire country on GMT.
|
|
|