• 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: do shell script date with last month's date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script date with last month's date


  • Subject: Re: do shell script date with last month's date
  • From: Bryan Harris <email@hidden>
  • Date: Fri, 14 Feb 2014 22:30:58 +0000 (GMT)


On Feb 14, 2014, at 08:44 AM, Christopher Stone <email@hidden> wrote:
On Feb 14, 2014, at 08:28, BevInTX <email@hidden> wrote:
I think that would always give January, when I think you really want the previous month, whatever that would be for the current date?
"date -v-1m '+%B %Y'"
Whups. Good catch. Those minuses are tricky... :)
 
I know this question is already solved, here is just another way using the GNU version of date.  It lets someone use more of a human language way of specifying the date.  E.g. "-10 minutes", "+2 days" etc.

/usr/local/Cellar/coreutils/8.21/bin/gdate -d 'last month' +"%B %Y"

January 2014


It comes with coreutils, which you can get with one of the package installers like HomeBrew.

V/r,
Bryan
 _______________________________________________
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:
    • posting terminal output to the list (was Re: do shell script date with last month's date)
      • From: 2551 <email@hidden>
    • Re(2): do shell script date with last month's date
      • From: JF <email@hidden>
References: 
 >Re: do shell script date with last month's date (From: Christopher Stone <email@hidden>)

  • Prev by Date: Macro vs Script
  • Next by Date: Re(2): do shell script date with last month's date
  • Previous by thread: Re: do shell script date with last month's date
  • Next by thread: Re(2): do shell script date with last month's date
  • Index(es):
    • Date
    • Thread