On 2008-08-26 11:50, Ron Johnson wrote:
On 08/25/08 20:34, s. keeling wrote:
Ron Johnson [EMAIL PROTECTED]:
On 08/24/08 11:32, Rick Pasotto wrote:
Why pipe it to bc? Keep it in the shell:
$ echo $[$[$(date -d 20090824 +%s) - $(date -d 20080724 +%s)] / 86400]
396
[snip]
One stylistic
Arithmetic Expansion
Arithmetic expansion allows the evaluation
of an arithmetic expression and the substitution
of the result.
The format for arithmetic expansion is:
$((expression))
The old format $[expression] is deprecated
and will be removed in upcoming versions
On 08/25/08 20:34, s. keeling wrote:
Ron Johnson [EMAIL PROTECTED]:
On 08/24/08 11:32, Rick Pasotto wrote:
Why pipe it to bc? Keep it in the shell:
$ echo $[$[$(date -d 20090824 +%s) - $(date -d 20080724 +%s)] / 86400]
396
[snip]
One stylistic reason for piping to bc is that some people
On Tue, Aug 26, 2008 at 04:50:16AM -0500, Ron Johnson wrote:
On 08/25/08 20:34, s. keeling wrote:
I've been running *nix on my home boxes since '93, and I've never even
seen that syntax. That's a bashism, I hope?
Yes. And a relatively modern one at that. Somewhere in the 3.x series.
I
Ron Johnson [EMAIL PROTECTED]:
On 08/24/08 11:32, Rick Pasotto wrote:
Why pipe it to bc? Keep it in the shell:
$ echo $[$[$(date -d 20090824 +%s) - $(date -d 20080724 +%s)] / 86400]
396
[snip]
One stylistic reason for piping to bc is that some people think that
bash's $[]
On Sunday 24 August 2008 18.07.59 j t wrote:
Hi all.
Does anyone have any suggestions for a command-line-interface (CLI)
calculator that can work out the difference between 2 (gregorian)
dates (i.e. that is calendar aware). My favourite cli calculator
(bc) doesn't seem to have any knowledge
On 08/24/08 10:07, j t wrote:
Hi all.
Does anyone have any suggestions for a command-line-interface (CLI)
calculator that can work out the difference between 2 (gregorian)
dates (i.e. that is calendar aware). My favourite cli calculator
(bc) doesn't seem to have any knowledge of the gregorian
j t wrote:
Hi all.
Does anyone have any suggestions for a command-line-interface (CLI)
calculator that can work out the difference between 2 (gregorian)
dates (i.e. that is calendar aware). My favourite cli calculator
(bc) doesn't seem to have any knowledge of the gregorian calendar.
Just to
On 08/24/08 10:54, Edward J. Shornock wrote:
[snip]
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724 +%j) | bc
31
That a good idea. I never knew date(1) could do that. The problem,
though, is that
On Sun, Aug 24, 2008 at 11:25:31AM -0500, Ron Johnson wrote:
On 08/24/08 10:54, Edward J. Shornock wrote:
[snip]
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724 +%j) | bc
31
That a good idea. I
On 08/24/08 11:32, Rick Pasotto wrote:
On Sun, Aug 24, 2008 at 11:25:31AM -0500, Ron Johnson wrote:
On 08/24/08 10:54, Edward J. Shornock wrote:
[snip]
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724
On Sun, 2008-08-24 at 11:25 -0500, Ron Johnson wrote:
On 08/24/08 10:54, Edward J. Shornock wrote:
[snip]
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724 +%j) | bc
31
That a good idea. I
On 24 Ago, 17:10, j t [EMAIL PROTECTED] wrote:
[snip]
(I'm happy to use any date format for input - I've only used ISO8601
as an example)
Maybe something like that:
#!/usr/bin/python
from time import mktime, strptime
from sys import argv
class DummyDate:
def __init__(self, strdate,
On 08/24/08 12:41, Damon L. Chesser wrote:
On Sun, 2008-08-24 at 11:25 -0500, Ron Johnson wrote:
On 08/24/08 10:54, Edward J. Shornock wrote:
[snip]
While I'm sure someone else will provide a much better way, I've used
something like
$ echo $(date -d 20080824 +%j) - $(date -d 20080724 +%j)
On 2008-08-24 11:13:43 -0500, Ron Johnson wrote:
I think I'd write a simple Python/Perl script: convert date1 and date2 to
seconds past epoch, subtract, and divide by 86400.
In Perl, you can also use the Date::Manip module:
4. The amount of time between two dates.
$date1 =
On 2008-08-24 12:25:00 -0500, Ron Johnson wrote:
I was thinking that integer division might result in the occasional
rounding error.
This is the contrary: AFAIK, you really want an integer division.
So, integer arithmetic is OK. But a floating-point division can
be a problem since when the
16 matches
Mail list logo