Re: Dates
Re: Dates
- Subject: Re: Dates
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 3 Jan 2008 10:49:21 -0500
As far as I know, the Applescript date class has no representation or concept of time zones. The Mail application will always return the "date sent" and "date received" properties in the *local* time zone, no matter what the header says in the message.
e.g. I have a message with this Date: header:
Date: Sun, 29 Jul 2007 15:03:04 -0300
When I ask for the "date sent" of the message in Mail, I get this:
date "Sunday, July 29, 2007 2:03:04 PM"
So it has automatically converted from the original time zone (3 hours west of UTC) to my time zone (officially 5 hours west of UTC, but on July 29 it was 4 hours west due to daylight saving time).
From which I assume that you will need to do all comparisons with local time; any date strings you're using to compare with, convert to local time yourself first.
On Jan 3, 2008 9:19 AM, Michael <
email@hidden> wrote:
> Yes...you are correct of course....thank you. But, may I ask another
> issue that has arisen. If the date sent is in a different time zone,
> then Mail ( and I guess the system, presents the time in local
> time...which makes sense. ( I assume it uses the settings as defined
> by the user). So, if one compares two equivalent times, but in
> different time zones, does the OS consider them equal ie the
> string might be different, but the object date should be the same.
Here is what I am now using.
set msgs to every message of (mailbox "INBOX" of account "Foo") whose
(message id is "
email@hidden") and (date sent is Date "Wed, 14 Nov 2007
15:12:15 +0100")
Now, I am in Time zone -8, so the time shown on that particular email
is different, but I would have thought that it would still select it.
I have not yet figured out why it is not selecting it, but it isn't.
Any insight would be helpful.
thank you all as usual.
Michael.
> Hello Michael,
>
> Just reading above code, it looks like the problem must be with:
>
> (date sent is "Wednesday, January 2, 2008 3:22:23 PM")
>
> Property 'date sent' is of class date, while "Wednesday, January 2,
> 2008 3:22:23 PM" is a string.
> The equality operator (i.e. the 'is' operator) always first checks
> the classes of its operands: if their classes are not the same, the
> operands are always considered as non equal.
> As a result, your whose clause always evaluates to false.
>
> Could you try with
>
> (date sent is date "Wednesday, January 2, 2008 3:22:23 PM")
>
> so that the second operand is of class date too?
>
> HTH,
> Axel
> _
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (
Archives:
http://lists.apple.com/archives/applescript-usersThis email sent to
email@hidden
--
Mark J. Reed <
email@hidden>
_______________________________________________
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
References: | |
| >Dates (From: Michael <email@hidden>) |
| >Re: Dates (From: Michelle Steiner <email@hidden>) |
| >Re: Dates (From: Michael <email@hidden>) |
| >Re: Dates (From: Axel Luttgens <email@hidden>) |
| >Re: Dates (From: Michael <email@hidden>) |