• 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" vs current date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do shell script "date" vs current date


  • Subject: Re: Do shell script "date" vs current date
  • From: JollyRoger <email@hidden>
  • Date: Mon, 11 Mar 2002 19:22:30 -0600

On 3/11/2002 10:23 AM, "John W Baxter" <email@hidden> wrote:

> At 8:38 -0700 3/11/2002, garbanzito wrote:
>> however even just the shell's date command has some options
>> that might be hard to reproduce with current date.
>
> For instance,
> do shell script "date +%Y-%m-%d"
> --> "2002-03-11"

It's not _that_ hard to do:

-- begin script
My FormatDate(current date)

on FormatDate(theDate)
set theDate to theDate as date
set dd to text -2 thru -1 of ("0" & theDate's day)
copy theDate to tempDate
set the month of tempDate to January
set mm to text -2 thru -1 of ,
("0" & 1 + (theDate - tempDate + 1314864) div 2629728)
set yy to text -1 thru -4 of ((year of theDate) as text)
return (yy & "-" & mm & "-" & dd as text)
end FormatDate
-- end script

JR
_______________________________________________
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: Do shell script "date" vs current date (From: John W Baxter <email@hidden>)

  • Prev by Date: [OFF] Forging To headers in list posts (was Re: Spam Filter Script?)
  • Next by Date: Re: [OFF] Forging To headers in list posts (was Re: Spam Filter Script?)
  • Previous by thread: Re: Do shell script "date" vs current date
  • Next by thread: Re: Do shell script "date" vs current date
  • Index(es):
    • Date
    • Thread