• 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: Get ID of items Modified with 1 month
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get ID of items Modified with 1 month


  • Subject: Re: Get ID of items Modified with 1 month
  • From: Anton Wilson <email@hidden>
  • Date: Tue, 18 Mar 2003 11:27:33 -0600

On Monday, March 17, 2003, at 06:39 PM, Michelle Steiner wrote:
date -1 returns one second earlier than when the script is run. Try date - 30 * days minutes, hours, days, and weeks are defined constants. Unfortunately, months is not because the number of seconds in a month varies, depending upon which month it is. So, if you don't have to be exact for one month, 30 days may be a reasonable > substitute.


The Unix 'date' command can easily solve many tricky date manipulations that pre-X required jumping thru handler hoops to solve.

set mm to do shell script "date '+%m'"
--> "03"

The Unix 'cal' command can also come in handy:
set mmCount to word -1 of (do shell script "cal") as number
--> 31
set febCount to word -1 of (do shell script "cal 2 2003") as number
--> 28

Or if your looping thru every day of the month building urls:
set dayList to words 10 thru -1 of (do shell script "cal")
-->{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}

Regarding the date manipulations, here is a list:

%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%c shorthand for %X %x, the locale format for date and time
%d day of the month as a decimal number (01-31)
%e same as %d but does not print the leading 0 for days 1 through 9
%F milliseconds as a decimal number (000-999)
%H hour based on a 24-hour clock as a decimal number (00-23)
%I hour based on a 12-hour clock as a decimal number (01-12)
%j day of the year as a decimal number (001-366)
%m month as a decimal number (01-12)
%M minute as a decimal number (00-59)
%p AM/PM designation for the locale
%S second as a decimal number (00-59)
%w weekday as a decimal number (0-6), where Sunday is 0
%x date using the date representation for the locale
%X time using the time representation for the locale
%y year without century (00-99)
%Y year with century (such as 1990)
%Z time zone name (such as Pacific Daylight Time)
%z time zone offset in hours and minutes from GMT (HHMM)


--Anton Wilson
_______________________________________________
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.

References: 
 >Re: Get ID of items Modified with 1 month (From: Michelle Steiner <email@hidden>)

  • Prev by Date: moving multiple *selected* messages in Eudora
  • Next by Date: Re: moving multiple *selected* messages in Eudora
  • Previous by thread: Re: Get ID of items Modified with 1 month
  • Next by thread: Re: Get ID of items Modified with 1 month
  • Index(es):
    • Date
    • Thread