Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon6.gif   calculate diff of 2 date(s), posted by Alex Kühnel on Wed Sep 28 18:48:04 2016 
    icon2.gif   Re: calculate diff of 2 date(s), posted by Alex Kühnel on Fri Sep 30 11:21:44 2016 
       icon2.gif   Re: calculate diff of 2 date(s), posted by Alex Kühnel on Fri Sep 30 11:25:08 2016 
          icon2.gif   Re: calculate diff of 2 date(s), posted by Stefan Ritt on Fri Sep 30 12:33:38 2016 
             icon2.gif   Re: calculate diff of 2 date(s), posted by Alex Kühnel on Mon Oct 3 10:01:53 2016 
Message ID: 68436     Entry time: Fri Sep 30 11:25:08 2016     In reply to: 68435     Reply to this: 68437
Icon: Reply  Author: Alex Kühnel  Author Email: alexander.kuehnel@gmail.com 
Category: Question  OS: Linux  ELOG Version: 3.1.2 
Subject: Re: calculate diff of 2 date(s) 

is ist possible that subst only works for the initial create of a logbook entry? when I change/edit one of the parameter "Einsatzbegin" or "Einsatzende" the "Einsatzzeit" is not changed.

regards

/alex

Alex Kühnel wrote:

I found the solution in the forum :-)

subst Einsatzzeit = $shell(/usr/local/elog/diff.sh \"$Einsatzbeginn\" \"$Einsatzende\")

and diff.sh is

#!/bin/sh
#set -x
s1=$(date -d "$1" +%s)
s2=$(date -d "$2" +%s)
d=$(echo "($s2-$s1)/60"|bc -lq)
printf "%.0f Minuten" $d
 

 

 

Alex Kühnel wrote:

hi

I have an elogsystem for documenting emergency services. I have a starttime and an endtime. Is it possible to calculate the diff between the 2 timestamps and convert it to minutes?

 

Attributes = Bereitschafts Kalender Woche, Bereitschafts Woche, Einsatzbeginn, Einsatzende, Einsatzzeit, Telefon Nummer, Station, Status, Problem 
Options Status= Offen{1}, Erledigt{2}, Geschlossen{3}

......

Type Einsatzbeginn = datetime
Type Einsatzende = datetime

....

Subst Einsatzzeit  = $shell(Einsatzende - Einsatzbeginn) 

 

regards

/alex

 

 

ELOG V3.1.5-fe60aaf