• 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: Another question on dates and times
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another question on dates and times


  • Subject: Re: Another question on dates and times
  • From: Philip Aker <email@hidden>
  • Date: Fri, 07 Dec 2007 00:54:34 -0800

On 2007-12-06, at 07:27, Mark J. Reed wrote:

On Dec 5, 2007 3:18 PM, Philip Aker <email@hidden> wrote:
Here's a way to achieve what I think is the goal of your script in a more compact form. The key thing I'm illustrating is the use of the special input strings "0" and "1" to get relative dates out of AppleScript easily.

Er, I'm confused...

set rs_date to ((date (1 as text)) - 1 * days)
set re_date to date (0 as text)

What exactly do those do?

date "<some number>" = some day of the month at 00:00:00 (current user's time zone). Watch out for this because date "32" is bad and so is date "29" in February in a non leap year.

date "0" -- Current day of the month. Type this into Script Editor, compile, and watch what happens.

date (0 as text) -- Stop Script Editor from resolving "0" to the current date.

set rs_date to ((date (1 as text)) - 1 * days) -- First day of the month (script is run on) - 1 day = last day of the previous month.


Where do the report start and end times get entered into the script?

Sorry to say, I'm having trouble with the question. I'm formatting the date outputs with:

FormatDateWithDelimiter()

and then summing all the string values returned from multiple calls on the last line.


on FormatDateWithDelimiter(thePrefix, theDate, theDelimiter, theSuffix)
set d to theDelimiter
return thePrefix & ((month of theDate) as number) & d & day of theDate & d & year of theDate & theSuffix
end FormatDateWithDelimiter

set rs_date to ((date (1 as text)) - 1 * days)
set re_date to date (0 as text)
set ctime to time of (current date)

set r_time to FormatDateWithDelimiter("Report Time: ", re_date, "-", "_" & ctime)
set r_end to FormatDateWithDelimiter("Report End: ", re_date, "/", "")
set r_beg to FormatDateWithDelimiter("Report Start: ", rs_date, "/", "")

r_time & return & r_beg & return & r_end


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

 _______________________________________________
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: 
 >Re: Another question on dates and times (From: Ron <email@hidden>)
 >Re: Another question on dates and times (From: Philip Aker <email@hidden>)
 >Re: Another question on dates and times (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Scripting iCal 3
  • Next by Date: Re: Problem with reading 4-byte floats from file on Intel
  • Previous by thread: Re: Another question on dates and times
  • Next by thread: Any Mail rule script I try causes all applications to stall
  • Index(es):
    • Date
    • Thread