• 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: Ron <email@hidden>
  • Date: Wed, 5 Dec 2007 02:25:33 -0600

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


set AppleScript's text item delimiters to ""
set number_of_days to 5
set current_date_of_report to current date
month of (current_date_of_report)
set currentmonth to result as number
if currentmonth < "10" then
set currentmonth to "0" & currentmonth as string
end if
day of (current_date_of_report)
set currentday to result
if currentday < "10" then
set currentday to "0" & currentday as string
end if
year of (current_date_of_report)
set currentyear to result
set currentdate to currentmonth & "-" & currentday & "-" & currentyear as string
set current_time to time of (current_date_of_report) as string
set run_time to currentdate & "_" & current_time
log "run_time = " & run_time


month of (current_date_of_report)
set current_month to result as number
if current_month < "10" then
set current_month to "0" & current_month as string
end if
day of (current_date_of_report)
set current_day to result
if current_day < "10" then
set current_day to "0" & current_day as string
end if
year of (current_date_of_report)
set current_year to result
set the_date_to_end_the_report to current_month & "/" & current_day & "/" & current_year as string
log "the_date_to_end_the_report = " & the_date_to_end_the_report


set previous_date to ((current_date_of_report) - (number_of_days * days))
month of (previous_date)
set previous_month to result as number
if previous_month < "10" then
set previous_month to "0" & previous_month as string
end if
day of (previous_date)
set previous_day to result
if previous_day < "10" then
set previous_day to "0" & previous_day as string
end if
year of (previous_date)
set previous_year to result
set the_date_to_begin_the_report to previous_month & "/" & previous_day & "/" & previous_year as string
log "the_date_to_begin_the_report = " & the_date_to_begin_the_report
_______________________________________________
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: Philip Aker <email@hidden>
    • Re: Another question on dates and times
      • From: Skeeve <email@hidden>
  • Prev by Date: Re: Is shorter better? (Was: Wow, AppleScript is tough!)
  • Next by Date: Re: Wow, AppleScript is tough!
  • Previous by thread: Re: Another question on dates and times
  • Next by thread: Re: Another question on dates and times
  • Index(es):
    • Date
    • Thread