• 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: Wed, 05 Dec 2007 12:18:34 -0800

On 2007-12-05, at 00:25, Ron wrote:

This is my standard date and time script I use when generating reports with beginning and end dates.

Hi Ron,

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.


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

  • Follow-Ups:
    • Re: Another question on dates and times
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Re: Another question on dates and times (From: Ron <email@hidden>)

  • Prev by Date: Re: Is shorter better? (Was: Wow, AppleScript is tough!)
  • Next by Date: Re: Spell checking in Applescript
  • Previous by thread: Re: Another question on dates and times
  • Next by thread: Re: Another question on dates and times
  • Index(es):
    • Date
    • Thread