I need to write a script:
startdate = 2016-02-14 20:10:10
enddate = 2016-02-14 23:59:59
c= 1240 (minutes)
d=10
r = ratio(startdate - enddate) / c;
d=d*r;
How to calculate the difference between the start date and the end date?
I need to write a script:
startdate = 2016-02-14 20:10:10
enddate = 2016-02-14 23:59:59
c= 1240 (minutes)
d=10
r = ratio(startdate - enddate) / c;
d=d*r;
How to calculate the difference between the start date and the end date?
To calculate seconds between two times:
#!/bin/bash
START="2016-02-14 20:10:10"
END="2016-02-14 23:59:59"
SECS=$(echo $(date -d "$END" +%s) - $(date -d "$START" +%s) | bc)
echo $SECS
what is | bc in the script ?
can you please confirm me Sorry if i am asking wrong question
– AAA Oct 26 '16 at 14:01SECS=$(echo $(some command pipeline))
? It would be far better to use SECS=$(some command pipeline)
and avoid a layer of complication.
– Chris Davies
Oct 26 '16 at 14:15
$c
? – Stéphane Chazelas Oct 26 '16 at 11:15date
command. thus, subsequent calculation are quite easy to perform. – user236012 Oct 26 '16 at 11:15