• 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: Convert long number to string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert long number to string


  • Subject: Re: Convert long number to string
  • From: Graff <email@hidden>
  • Date: Sun, 18 Apr 2004 01:27:05 -0400

On Apr 18, 2004, at 12:43 AM, Paul Berkowitz wrote:

On 4/17/04 8:13 PM, "Gnarlodious" <email@hidden> wrote:

Entity Graff spoke thus:

set realNumber to do shell script "echo `date +%s` - `date +%s` %
604800 | bc"

Basically it gets the date in seconds from the epoch twice and puts the
values in an echo statement which passes a string to the shell tool bc.
The tool bc, which is a calculation tool,
Great! Now I know what Martin was talking about when he mentioned "bc".
I actually found it here:
(copy and paste URI)
<file://localhost/127.0.0.1/Library/Documentation/Commands/dc/ dc_toc.html>

<file:///Library/Documentation/Commands/dc/dc_toc.html>

is what works in my case. But that's dc, not bc.

Same here.

I used bc because it's a little bit more straightforward than dc. You can use dc instead but it uses reverse polish notation and a few related concepts. The command when written for dc would be:

echo `date +%s` `date +%s` 604800 % - p | dc

for comparison here is the line written for bc:

echo `date +%s` - `date +%s` % 604800 | bc

As you can see, the bc command is a bit easier to comprehend.

- Ken
_______________________________________________
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.


  • Follow-Ups:
    • Re: Convert long number to string
      • From: Gnarlodious <email@hidden>
References: 
 >Re: Convert long number to string (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Convert long number to string
  • Next by Date: Re: Convert long number to string
  • Previous by thread: Re: Convert long number to string
  • Next by thread: Re: Convert long number to string
  • Index(es):
    • Date
    • Thread