Re: current date - 1 day?
Re: current date - 1 day?
- Subject: Re: current date - 1 day?
- From: Matthew Smith <email@hidden>
- Date: Tue, 17 Feb 2004 18:28:29 +1100
on 17/02/2004 17:59, Stephen Schaefer at email@hidden wrote:
>
Probably simple newbie question, so hopefully a simple answer: why
>
does "yesterday" result in "-86383" instead of 16 (as in today is the
>
17th, so yesterday would be the 16th)? Thanks
>
>
set theDate to current date
>
set d to day of theDate
>
set m to month of theDate
>
set y to year of theDate
>
set ts to time string of theDate
>
set yesterday to (d) - (1 * days)
Here's your problem. The variable d would be 17. All you need to do to get
it to be 16 is minus 1 from it, not 1 * days. 1 * days is the number of
seconds in a day, I believe. You subtract it from a date variable.
set yesterday to d - 1
But then this won't work if d is 1. Yesterday will then be 0.
You should probably do:
set theDate to current date
set yesterdayDate to theDate - (1 * days)
You will then have 2 dates which are 24 hours apart. You can then extract
the date items from each.
--
Matthew Smith
_______________________________________________
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.