Begin-End Time display hours in calculation
Dear Podio, I have 2 App: App A and App B App A - Structure: Name: ABC Begin: date:Beginhour End: date:Endhour App B - Structure: reference with app A Calculation: No.                Name                   Begin-End 1                 ABC                    Beginhour - Endhour 2                 XYZ                    Beginhour1-Endhour1 .... Note: Begin & End hat same date. In calculation can view only hour (not date): Beginhour-Endhour Or option 2: Date-(Beginhour-Endhour) Is possible and how? Thanks  

  • Your example was 12 h/ AM w/o Minutes Thanks Rainer, in calculation, I want to see from Beginhour to Endhour , not Duration Example: Task A .......9AM to 11AM Or option 2: Task A: .....date 9AM to 11 AM  Note: Same day In your new example you have 24 h AND minutes.Here you find everything about handling time and date with momentjs http://momentjs.com/docs/24 h is simply .format("H") = 9 or "HH" = 09Adding Minutes is .format("H:m"). Yes you can sort. var begin = @all of begin:var end = @all of end:var name = @all of name;var rows = [];for(var i = 0; i < name.length; i++){rows.push (moment(begin).tz("Europe/Berlin").format("HHmm") + " " +  (i + 1) + "  |  " +  name +  "  |  "  + moment(begin).tz("Europe/Berlin").format("h A") + " - " + moment(end).tz("Europe/Berlin").format("h A"));};var rows = rows.sort();var rows2 = [];for(var i =0; i < rows.length; i++){rows2.push(rows[i].substr(5));};"No. |  Name |  Begin-End \\n" +"--- | --- | --- \\n"+rows2.join("\\n") Rainerrg@delos-consulting.com  
  • Thank you... But how can display time by 24hour. My begin field and end field are 24 hour. And can i short begin time from min to max, ex: No.        Name       Begin to end 1           ABC            9:00-15:00 2           DEF            9:15-11:00 3           MLN           15:00- 16:00 Thanks so much
  • Oh, that was a misunderstandingvar begin = @all of begin:var end = @all of end:var name = @all of name;var rows = [];for(var i = 0; i < name.length; i++){rows.push ((i + 1) + "  |  " +  name +  "  |  "  + moment(begin).tz("Europe/Berlin").format("h A") + " - " + moment(end).tz("Europe/Berlin").format("h A"));};"No. |  Name |  Begin-End \\n" +"--- | --- | --- \\n"+lines.join("\\n") For option 2: moment(begin).tz("Europe/Berlin").format("MM/DD/YYYY h A") .tz("Europe/Berlin") is my timezone, instead of "Europe/Berlin" you have to enter your timezone.   Rainer
  • Thanks Rainer, in calculation, I want to see from Beginhour to Endhour , not Duration Example: Task A .......9AM to 11AM Or option 2: Task A: .....date 9AM to 11 AM  Note: Same day Thanks
  • Hi, the difference in hours you get this way var begin = moment(@begin);var end = moment(@end);end.diff(begin,"h") Rainer
This question is closed.